Zum Hauptinhalt springen

Resource Locking

NOTES:

new feature in zync

Application: odoo_dumper - creating many2one many2many entries

Background: creating many2one entries may conflict within batches.

You can override a def in the worker:

def can_lock_resources(self):

And then

def lock_resources(self):

And provide strings to lock resources.

Thinkable other applications: You lock technical things, like network devices, certain web pages whatever.

Then only one batch at a time can run if resources are free.

Locked Resources are identified BEFORE the batch is started.

Basically any type of resource can be locked. Some ideas:

  • single records

  • network paths, network adapters

  • anything

To register a lock, a user defined lock key must be provided: a simple string like "res.partner,3", "res.partner - all", "south area of building".