mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
avoid work if nothing there
This commit is contained in:
parent
2d3a090060
commit
2625c3bb9a
1 changed files with 3 additions and 2 deletions
|
@ -4,6 +4,9 @@ class StylesheetCache < ActiveRecord::Base
|
|||
MAX_TO_KEEP = 10
|
||||
|
||||
def self.add(target,digest,content)
|
||||
|
||||
return false if where(target: target, digest: digest).exists?
|
||||
|
||||
success = create(target: target, digest: digest, content: content)
|
||||
|
||||
count = StylesheetCache.count
|
||||
|
@ -20,8 +23,6 @@ class StylesheetCache < ActiveRecord::Base
|
|||
success
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
false
|
||||
rescue PG::UniqueViolation
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue