Skip to main content

Module timed_mutex

Module timed_mutex 

Source
Expand description

A mutex that says when it was waited on, or held, for a long time.

The object store keeps one SQLite connection behind one lock, and every store call in the process takes it, many of them from async handlers. When something holds it for long (a commit waiting on a busy disk), every caller queues; a caller on a runtime worker takes the worker with it. Nothing said so: this does. A wait or a hold of SLOW or more logs one line, rate-limited, with where the lock was taken (a source location, never a key, a path or content), how long the caller waited and held, and whether it was a runtime worker (thread_roles). The behaviour of the lock is not changed.

Structs§

TimedGuard
The lock, held: derefs to the value, and logs on drop when this was slow.
TimedMutex
A Mutex that logs a slow wait or hold. store names which store it is, in the line.

Constants§

SLOW
A wait or a hold this long is logged.