Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

fix(light cull): poll light cull instead of timer #10559

Merged
merged 4 commits into from
Apr 4, 2019
Merged

Conversation

niklasad1
Copy link
Collaborator

@niklasad1 niklasad1 commented Apr 2, 2019

  • Adds light transactions queue cull polling on every call on eth_getTransactiobByHash request
  • Removes cull service which used a hardcoded timer every 10th minute

pub fn light_cull(&self, txq: Arc<RwLock<TransactionQueue>>) -> impl Future <Item = (), Error = Error> + Send {
let senders = txq.read().queued_senders();
if senders.is_empty() {
return Either::B(future::err(errors::no_light_transactions()));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very unlikely to happen but it could happen if there is a race with calls to eth_getTransactionByHash i.e, a cull finished just between the transaction_by_hash and light_cull.

Then don't do a needless network request

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should leave this is a comment within the code, just in case

if in_txqueue {
// Note, this will block (relies on HTTP timeout) to make sure `cull` will finish to avoid having to call
// `eth_getTransactionByHash` more than once to ensure the `txqueue` is up to `date` when it is called
if let Err(e) = self.fetcher().light_cull(self.transaction_queue.clone()).wait() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the most controversial thing about this PR.

The light_cull could be spawned in an executor but then we would most likely not get result in this call (accessing an atomic variable is much faster than a network request) and we would have to call this at least one more time to get the result!

@niklasad1 niklasad1 added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Apr 2, 2019
@soc1c soc1c added this to the 2.6 milestone Apr 2, 2019
rpc/src/v1/helpers/errors.rs Outdated Show resolved Hide resolved
rpc/src/v1/impls/light/eth.rs Outdated Show resolved Hide resolved
@ordian ordian added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Apr 3, 2019
@HCastano HCastano merged commit 10e1787 into master Apr 4, 2019
@HCastano HCastano deleted the cull-after-poll branch April 4, 2019 08:59
ordian added a commit that referenced this pull request Apr 5, 2019
* master:
  fix(light cull): poll light cull instead of timer (#10559)
  Update Issue Template to direct security issue to email (#10562)
  RPC: Implements eth_subscribe("syncing") (#10311)
  Explicitly enable or disable Stratum in config file (Issue 9785) (#10521)
  version: bump master to 2.6 (#10560)
  tx-pool: check transaction readiness before replacing (#10526)
  fix(light account response): update `tx_queue` (#10545)
  Update light client harcoded headers (#10547)
  fix(light eth_gasPrice): ask network if not in cache (#10535)
  Implement caching for service transactions checker (#10088)
  build android with cache, win fixes (#10546)
  clique: make state backfill time measurement more accurate (#10551)
  updated lru-cache to 0.1.2 (#10542)
soc1c pushed a commit that referenced this pull request Apr 8, 2019
* fix(light cull): poll light cull instead of timer

* fix(grumbles): remove error + updated docs

* fix(on-demand request): `expect()` reason

* docs(remove misleading info)
soc1c added a commit that referenced this pull request Apr 8, 2019
* Reject crazy timestamps instead of truncating.

* fix(light cull): poll light cull instead of timer (#10559)

* fix(light cull): poll light cull instead of timer

* fix(grumbles): remove error + updated docs

* fix(on-demand request): `expect()` reason

* docs(remove misleading info)
cdetrio pushed a commit to cdetrio/parity that referenced this pull request Apr 12, 2019
* Reject crazy timestamps instead of truncating.

* fix(light cull): poll light cull instead of timer (openethereum#10559)

* fix(light cull): poll light cull instead of timer

* fix(grumbles): remove error + updated docs

* fix(on-demand request): `expect()` reason

* docs(remove misleading info)

running code

return data is working
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants