Method: Cyclop::Job#save

Defined in:
lib/cyclop/job.rb

#saveObject

Save to queue



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/cyclop/job.rb', line 114

def save
  self.updated_at = Time.now.utc
  if persisted?
    raise NotImplementedError
  else
    self.created_at = updated_at
    self.delayed_until = ::Time.at(created_at.to_i + delay).utc
    self._id = collection.insert attributes, safe: true
  end
  true
rescue Mongo::OperationFailure
  false
end