storj-archived / bridge

Deprecated. Access the Storj network via simple REST API.
https://storj.io
GNU Affero General Public License v3.0
77 stars 44 forks source link

Sending ALLOC messages to long time offline farmer #557

Closed littleskunk closed 6 years ago

littleskunk commented 6 years ago

Package Versions

Replace the values below using the output from npm list storj-bridge.

{"title":"Storj Bridge","version":"7.4.0","description":"Access the Storj network using a simple REST API.","x-protocol-version":"1.2.0","x-core-version":"8.5.0"}

Expected Behavior

Please describe the program's expected behavior. Include an example of your usage code in the back ticks below if applicable.

Farmer with lastSeen more than 7 days old should not receive ALLOC messages.

Actual Behavior

Please describe the program's actual behavior. Please include any stack traces or log output in the back ticks below.

https://github.com/Storj/bridge/blob/863b2aa09715e2e0470af8b6947e807b7d330c60/lib/server/routes/frames.js#L174-L175

The bridge is sending ALLOC messages to all farmer even if they are offline for more than 7 days.
The bridge will never forget about a farmer. After a few month the list for ALLOC query is so hugh
that the few online farmer will only get an ALLOC once in a while.
braydonf commented 6 years ago

Was thinking about this earlier. I don't know if lastSeen will be the best option, but we need a way to clear out the benchmarking pool with multiple repeated failures.

littleskunk commented 6 years ago

Long time offline farmer should move responseTime close to 90sec. I guess it will take more than 7 days to get a responseTime of more than 60sec.

A perfect solution would be ignoring timeoutRate 1 in combination with: https://github.com/Storj/complex/issues/82 (increase timeoutRate on failed ALLOC) https://github.com/Storj/bridge/pull/521#issuecomment-356667583 (reset timeoutRate after 72 hours)

braydonf commented 6 years ago

Another option is to mark spaceAvailable:false with a day's worth of failed ALLOC responses, and when the farmer comes back online they will change it to spaceAvailable:true again and enter the benchmark pool again.

littleskunk commented 6 years ago

Yes please. That sounds like a very good idea :)