menu

Locking

class viewflow.lock.NoLock

No pessimistic locking, just execute flow task in transaction.

Not suitable when you have Join nodes in your flow.

viewflow.lock.no_lock
class viewflow.lock.SelectForUpdateLock(nowait=True, attempts=5)

Database lock uses select … for update on the process instance row.

Recommended to use with PostgreSQL.

viewflow.lock.select_for_update_lock
class viewflow.lock.CacheLock(cache=<django.core.cache.DefaultCacheProxy object>, attempts=5, expires=120)

Task lock based on Django cache.

Use it if primary cache backend has transactional add functionality, like memcached.

Example:

class MyFlow(Flow):
    lock_impl = CacheLock(cache=caches['locks'])

The example uses a different cache. The default cache is Django default cache configuration.

viewflow.lock.cache_lock