Yelp / doloop

Task loop for keeping things updated
Other
10 stars 10 forks source link

Support bumping IDs with randomly chosen lock_for #27

Closed pbhuss closed 9 years ago

pbhuss commented 9 years ago

doloop.bump's lock_for kwarg can now take a 2-tuple of the form (min_lock_for, max_lock_for), in which case each bumped ID will be randomly assigned a lock_for N such that min_lock_for <= N < max_lock_for.

This is useful because it allows IDs to be fetched randomly w.r.t. the order in which they were inserted. There is a performance benefit to bumping a set of IDs in a single call to doloop.bump instead of one call per ID (1 vs many mysql update statements issued).

sudarshang commented 9 years ago

LGTM

pbhuss commented 9 years ago

Decided to drop this change