Skip to content

Commit

Permalink
Ensure that the institution and user are set on the Task passed to Ca…
Browse files Browse the repository at this point in the history
…cheSubmittableCollectionsJob
  • Loading branch information
Alex Dolski committed Dec 18, 2023
1 parent 50fa0cd commit 0bc5355
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def create
(!user.submittable_collections_cached_at ||
(user.submittable_collections_cached_at &&
user.submittable_collections_cached_at < 12.hours.ago))
task = Task.create!(name: CacheSubmittableCollectionsJob.to_s)
task = Task.create!(name: CacheSubmittableCollectionsJob.to_s,
user: user,
institution: user.institution)
CacheSubmittableCollectionsJob.perform_later(user: user,
client_ip: request_context.client_ip,
client_hostname: request_context.client_hostname,
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ def update_submittable_collections
render plain: "A task is already in progress.", status: :conflict
return
end
@task = Task.create!(name: CacheSubmittableCollectionsJob.name)
@task = Task.create!(name: CacheSubmittableCollectionsJob.name,
user: @user,
institution: @user.institution)
CacheSubmittableCollectionsJob.perform_later(user: @user,
client_ip: request_context.client_ip,
client_hostname: request_context.client_hostname,
Expand Down

0 comments on commit 0bc5355

Please sign in to comment.