golemfactory / yapapi

Python high-level API for Golem.
https://yapapi.readthedocs.io/en/stable/
GNU Lesser General Public License v3.0
49 stars 22 forks source link

Fix the offer-recycling logic #980

Open johny-b opened 2 years ago

johny-b commented 2 years ago

Problem is explained in #979.

Idea: add a delay to offer recycling, e.g. 60s, so that we'll have enough time to try other offers first instead.

Also: this is not really a bug. If the strategy ignores AgreementRejected event then this is their problem, as such event is important and should not be ignored.

BUT

We should expect many strategy-implementers to forget about this detail (at least I forgot :P). So I guess if we can implement some mico-fix for such cases, as the Idea mentioned above, we probably should.

stranger80 commented 2 years ago

OK, so we have a situation, where Provider rejects a proposed Agreement (most often because they found another "job" in the meantime, so their offer became "invalid"). In such a case, the heuristic suggests, the Offer may again become "valid" after some time.

So, as requestors, we may not want to discard the Offer, but rather give it another chance. So we put it on "a bench" for arbitrary amount of time, hoping it becomes "valid" again.

This seems a better approach than simply "put it at the end of the queue", as the time factor (ie. waiting for some time) is crucial here. And I can't think of any better heuristic.

I would only consider the following: