From 8422262eba28c9a0fe49619d0732b6b67eb770b0 Mon Sep 17 00:00:00 2001 From: Athar Hameed <atharh@gmail.com> Date: Wed, 31 May 2017 12:29:53 +0800 Subject: [PATCH 1/4] Add logging on project mirroring failure --- app/workers/repository_update_mirror_worker.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/workers/repository_update_mirror_worker.rb b/app/workers/repository_update_mirror_worker.rb index ee23a154dd8ec..39bacf22afa34 100644 --- a/app/workers/repository_update_mirror_worker.rb +++ b/app/workers/repository_update_mirror_worker.rb @@ -20,6 +20,7 @@ def perform(project_id) result = Projects::UpdateMirrorService.new(project, @current_user).execute if result[:status] == :error project.mark_import_as_failed(result[:message]) + Rails.logger.error("RepositoryUpdateMirrorWorker: import failed for project #{project.id}") return end @@ -27,6 +28,7 @@ def perform(project_id) rescue => ex if project project.mark_import_as_failed("We're sorry, a temporary error occurred, please try again.") + Rails.logger.error("RepositoryUpdateMirrorWorker: import failed for project #{project.id}") raise UpdateMirrorError, "#{ex.class}: #{Gitlab::UrlSanitizer.sanitize(ex.message)}" end end -- GitLab From 12dbd643cf1af518736879ab3c8eca6e062dcb04 Mon Sep 17 00:00:00 2001 From: Collen Kriel <collen.kriel@gmail.com> Date: Wed, 31 May 2017 11:42:06 +0700 Subject: [PATCH 2/4] Add error logging to RepositoryUpdateRemoteMirrorWorker for failed push to remote repository --- app/workers/repository_update_remote_mirror_worker.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/workers/repository_update_remote_mirror_worker.rb b/app/workers/repository_update_remote_mirror_worker.rb index f4fbc6424ff53..bc23e3d376a99 100644 --- a/app/workers/repository_update_remote_mirror_worker.rb +++ b/app/workers/repository_update_remote_mirror_worker.rb @@ -30,6 +30,7 @@ def perform(remote_mirror_id, scheduled_time) raise rescue UpdateError => ex remote_mirror.mark_as_failed(Gitlab::UrlSanitizer.sanitize(ex.message)) + Rails.logger.error("RepositoryUpdateRemoteMirrorWorker: push to remote repository #{remote_mirror.project.id} failed") raise rescue => ex raise UpdateError, "#{ex.class}: #{ex.message}" -- GitLab From 774b8a0e1e571ad63b014bc654abb7f271604126 Mon Sep 17 00:00:00 2001 From: Athar Hameed <atharh@gmail.com> Date: Wed, 31 May 2017 14:42:54 +0800 Subject: [PATCH 3/4] Remove hard-coded class names + update commit message --- app/workers/repository_update_mirror_worker.rb | 4 ++-- app/workers/repository_update_remote_mirror_worker.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/workers/repository_update_mirror_worker.rb b/app/workers/repository_update_mirror_worker.rb index 39bacf22afa34..2e1b63619021d 100644 --- a/app/workers/repository_update_mirror_worker.rb +++ b/app/workers/repository_update_mirror_worker.rb @@ -20,7 +20,7 @@ def perform(project_id) result = Projects::UpdateMirrorService.new(project, @current_user).execute if result[:status] == :error project.mark_import_as_failed(result[:message]) - Rails.logger.error("RepositoryUpdateMirrorWorker: import failed for project #{project.id}") + Rails.logger.error("#{self.class}: mirror update failed for project #{project.id}") return end @@ -28,7 +28,7 @@ def perform(project_id) rescue => ex if project project.mark_import_as_failed("We're sorry, a temporary error occurred, please try again.") - Rails.logger.error("RepositoryUpdateMirrorWorker: import failed for project #{project.id}") + Rails.logger.error("#{self.class}: mirror update failed for project #{project.id}") raise UpdateMirrorError, "#{ex.class}: #{Gitlab::UrlSanitizer.sanitize(ex.message)}" end end diff --git a/app/workers/repository_update_remote_mirror_worker.rb b/app/workers/repository_update_remote_mirror_worker.rb index bc23e3d376a99..44606ba9f4008 100644 --- a/app/workers/repository_update_remote_mirror_worker.rb +++ b/app/workers/repository_update_remote_mirror_worker.rb @@ -30,7 +30,7 @@ def perform(remote_mirror_id, scheduled_time) raise rescue UpdateError => ex remote_mirror.mark_as_failed(Gitlab::UrlSanitizer.sanitize(ex.message)) - Rails.logger.error("RepositoryUpdateRemoteMirrorWorker: push to remote repository #{remote_mirror.project.id} failed") + Rails.logger.error("#{self.class}: push to remote repository #{remote_mirror.project.id} failed") raise rescue => ex raise UpdateError, "#{ex.class}: #{ex.message}" -- GitLab From 59a822988736595aee6e90520ae5e2df920ffad7 Mon Sep 17 00:00:00 2001 From: Athar Hameed <atharh@gmail.com> Date: Wed, 31 May 2017 16:30:41 +0800 Subject: [PATCH 4/4] Update log message --- app/workers/repository_update_mirror_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/repository_update_mirror_worker.rb b/app/workers/repository_update_mirror_worker.rb index 2e1b63619021d..2b62894fe018d 100644 --- a/app/workers/repository_update_mirror_worker.rb +++ b/app/workers/repository_update_mirror_worker.rb @@ -20,7 +20,7 @@ def perform(project_id) result = Projects::UpdateMirrorService.new(project, @current_user).execute if result[:status] == :error project.mark_import_as_failed(result[:message]) - Rails.logger.error("#{self.class}: mirror update failed for project #{project.id}") + Rails.logger.error("#{self.class}: #{result[:message]}. Project ID: #{project.id}") return end -- GitLab