-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Fenner
committed
Jun 16, 2020
1 parent
38dbda7
commit ed55ef5
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class UpdateDoiJob < ActiveJob::Base | ||
queue_as :lupo_background | ||
|
||
def perform(doi_id, options={}) | ||
doi = Doi.where(doi: doi_id).first | ||
|
||
if doi.blank? | ||
Rails.logger.error "[UpdateDoi] Error updating DOI " + doi_id + ": not found" | ||
elsif doi.update_attributes(version: doi.version.to_i + 1) | ||
Rails.logger.debug "[UpdateDoi] Successfully updated DOI " + doi_id | ||
else | ||
Rails.logger.error "[UpdateDoi] Error updating DOI " + doi_id + ": " + doi.errors.messages.inspect | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters