From 46de0366b1cc50e67747a457810a54e679bec151 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 17 May 2016 13:59:29 -0500 Subject: [PATCH 1/3] Fix concurrent request when updating build log in browser --- CHANGELOG | 1 + app/assets/javascripts/ci/build.coffee | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d26a0bff2e..80b9833edd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -38,6 +38,7 @@ v 8.8.0 - Upgrade Sidekiq to 4.1.2 - Added /health_check endpoint for checking service status - Make 'upcoming' filter for milestones work better across projects + - Fix concurrent request when updating build log in browser - Sanitize repo paths in new project error message - Bump mail_room to 0.7.0 to fix stuck IDLE connections - Remove future dates from contribution calendar graph. diff --git a/app/assets/javascripts/ci/build.coffee b/app/assets/javascripts/ci/build.coffee index fca0c3bae5..d700742e4a 100644 --- a/app/assets/javascripts/ci/build.coffee +++ b/app/assets/javascripts/ci/build.coffee @@ -28,12 +28,13 @@ class CiBuild # CiBuild.interval = setInterval => if window.location.href.split("#").first() is build_url + last_state = @state $.ajax url: build_url + "/trace.json?state=" + encodeURIComponent(@state) dataType: "json" success: (log) => - @state = log.state - if log.status is "running" + if last_state is @state and log.status is "running" + @state = if log.state then log.state else "" if log.append $('.fa-refresh').before log.html else From cdec9e472db581acbee72cdcaa703e4155cb4cfb Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 23 May 2016 20:38:30 -0500 Subject: [PATCH 2/3] Replace \n to
--- app/assets/javascripts/ci/build.coffee | 6 ++++-- lib/ci/ansi2html.rb | 4 +++- spec/lib/ci/ansi2html_spec.rb | 9 +++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/ci/build.coffee b/app/assets/javascripts/ci/build.coffee index d700742e4a..98d05e4127 100644 --- a/app/assets/javascripts/ci/build.coffee +++ b/app/assets/javascripts/ci/build.coffee @@ -33,8 +33,10 @@ class CiBuild url: build_url + "/trace.json?state=" + encodeURIComponent(@state) dataType: "json" success: (log) => - if last_state is @state and log.status is "running" - @state = if log.state then log.state else "" + return unless last_state is @state + + if log.state and log.status is "running" + @state = log.state if log.append $('.fa-refresh').before log.html else diff --git a/lib/ci/ansi2html.rb b/lib/ci/ansi2html.rb index c628257e3f..229050151d 100644 --- a/lib/ci/ansi2html.rb +++ b/lib/ci/ansi2html.rb @@ -90,7 +90,7 @@ module Ci def convert(raw, new_state) reset_state - restore_state(raw, new_state) if new_state + restore_state(raw, new_state) if new_state.present? start = @offset ansi = raw[@offset..-1] @@ -105,6 +105,8 @@ module Ci break elsif s.scan(/' else @out << s.scan(/./m) end diff --git a/spec/lib/ci/ansi2html_spec.rb b/spec/lib/ci/ansi2html_spec.rb index 04afbd0692..898f1e84ab 100644 --- a/spec/lib/ci/ansi2html_spec.rb +++ b/spec/lib/ci/ansi2html_spec.rb @@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do it_behaves_like 'stateable converter' end + + context 'with new line' do + let(:pre_text) { "Hello\r" } + let(:pre_html) { "Hello\r" } + let(:text) { "\nWorld" } + let(:html) { "
World" } + + it_behaves_like 'stateable converter' + end end end From 24ef7063bee25c76ecfc8c14c494161208b01352 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 23 May 2016 21:58:16 -0500 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 80b9833edd..d07c95600b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ v 8.9.0 (unreleased) v 8.8.2 (unreleased) - Fix Error 500 when accessing application settings due to nil disabled OAuth sign-in sources - Fix Error 500 in CI charts by gracefully handling commits with no durations + - Fix concurrent request when updating build log in browser v 8.8.1 - Add documentation for the "Health Check" feature @@ -38,7 +39,6 @@ v 8.8.0 - Upgrade Sidekiq to 4.1.2 - Added /health_check endpoint for checking service status - Make 'upcoming' filter for milestones work better across projects - - Fix concurrent request when updating build log in browser - Sanitize repo paths in new project error message - Bump mail_room to 0.7.0 to fix stuck IDLE connections - Remove future dates from contribution calendar graph.