1

Let's say I have a domain object which was selected with "lock:true", or simply locked afterwards. Is there a way to save() it's state to the database without releasing the lock? (As I understaind, the default behavior is that save() releases the lock.)

I have a long (time-wise) function with many operations which should lock the object during the whole execution, however since some of the parts of the function can fail I would like to save the object's state during execution at certain points.

tim_yates
  • 167,322
  • 27
  • 342
  • 338
Cray
  • 2,396
  • 19
  • 29

1 Answers1

1

Successful save() returns the instance itself, you can lock() that again if you are not worried about the infinitesimal chance of a fetch while update.

domain.save()?.lock()

dmahapatro
  • 49,365
  • 7
  • 88
  • 117