Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request filtering should have an optional timeout #42

Open
AndrejMitrovic opened this issue Feb 11, 2020 · 2 comments
Open

Request filtering should have an optional timeout #42

AndrejMitrovic opened this issue Feb 11, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@AndrejMitrovic
Copy link
Contributor

Currently the filter Control API is used like so:

node_1.filter!(node_1.putTransaction);
node_2.putTransaction(...);  // triggers gossiping to node 1's putTransaction
Thread.sleep(500.msecs);
node_1.clearFilter();  // after this point the retry mechanism of a node could make the request succeed

However this has a crucial assumption: that the putTransaction of node_2 is an asynchronous call. If it's not, then the main thread will block, node_2 will have its putTransaction request fail after a number of retries, and by that point the node_1.clearFilter call in the main thread will be too late.

It makes more sense to make this timeout built-in into Localrest, to make it usable with blocking APIs. The new code (assuming putTransaction is now blocking) would look like:

node_1.filter!(node_1.putTransaction, 500.msecs);
node_2.putTransaction(...);
// now check if gossiping succeeded, or if max retries were reached
@AndrejMitrovic AndrejMitrovic added the enhancement New feature or request label Feb 11, 2020
@MichaelKim20
Copy link
Contributor

MichaelKim20 commented Feb 17, 2020

I have three questions.

  1. Can multiple pairs of filtered 'method and timeout' register?
  2. If the filter is registered and a clearFilter() was received before the timeout period, is the filter valid?
    Does timeout have a bigger priority than ClearFilter()?
  3. Or is the filter automatically turned off after the time limit?

@AndrejMitrovic
Copy link
Contributor Author

When I opened this issue, I had a talk with @Geod24. The conclusion was that we probably don't need this feature. So I would ignore this issue for now until we re-visit it later @MukeunKim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants