fpco / libraries

FP Complete libraries mega-repo
2 stars 0 forks source link

Revisit collection of stale activeKeys #195

Open kantp opened 8 years ago

kantp commented 8 years ago

The solution implemented for #133 is suboptimal in two aspects:

  1. It uses the redis KEYS command, which can be bad for performance.
  2. It does something very similar to the heartbeat checker, and I think it should be possible to modify the heartbeat checker to make the stale key checker obsolete. This would leave us with less code, less threads, and easier maintenance.

The solution to 1. is rather straightforward: KEYS is used to find all workers that have their activeKey set. We could either

I'm leaning towards the latter option.

I think 2. should be possible by changing the heartbeat checker to check the heartbeats of all workers that satisfy at least one of the following