mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-20 00:35:22 +00:00
Fix misconfigured concurrency on migration job
This commit is contained in:
parent
acef1d5726
commit
21f6a20c76
2 changed files with 4 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ class UsersController < ApplicationController
|
|||
OneTime::MigrateUserFromHackatimeJob.perform_later(@user.id)
|
||||
|
||||
redirect_to is_own_settings? ? my_settings_path : user_settings_path(@user),
|
||||
notice: "Heartbeats migrated successfully"
|
||||
notice: "Heartbeats & api keys migration started"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
class OneTime::MigrateUserFromHackatimeJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
include GoodJob::ActiveJobExtensions::Concurrency
|
||||
|
||||
# only allow one instance of this job to run at a time
|
||||
good_job_control_concurrency_with(
|
||||
key: -> { "migrate_user_from_hackatime_job_#{user_id}" },
|
||||
key: -> { "migrate_user_from_hackatime_job_#{arguments.first}" },
|
||||
total_limit: 1,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue