Suspend sailors log poll for users with active migrations (#221)

This commit is contained in:
Max Wofford
2025-05-12 14:58:55 -04:00
committed by GitHub
parent 1e6e5c0517
commit 2d3b2283af
2 changed files with 10 additions and 0 deletions

View File

@@ -30,6 +30,9 @@ class SailorsLogPollForChangesJob < ApplicationJob
private
def update_sailors_log(sailors_log)
# Skip if there's an active migration job for this user
return [] if sailors_log.user.in_progress_migration_jobs?
project_updates = []
project_durations = Heartbeat.where(user_id: sailors_log.user.id)
.group(:project).duration_seconds

View File

@@ -67,6 +67,13 @@ class User < ApplicationRecord
).order(created_at: :desc).limit(10).all
end
def in_progress_migration_jobs?
GoodJob::Job.where(job_class: "MigrateUserFromHackatimeJob")
.where("serialized_params->>'arguments' = ?", [ id ].to_json)
.where(finished_at: nil)
.exists?
end
def set_neighborhood_channel
return unless slack_uid.present?