mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
Suspend sailors log poll for users with active migrations (#221)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user