Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Consistently return a Deferred in the descriptor cache #3455

Closed
wants to merge 3 commits into from

Conversation

hawkowl
Copy link
Contributor

@hawkowl hawkowl commented Jun 27, 2018

No description provided.

@hawkowl hawkowl requested a review from a team June 27, 2018 10:02
@erikjohnston
Copy link
Member

I have a horrible suspicion we might have been doing this on purpose so that we don't incur the cost of wrapping/unwrapping the deferred

@hawkowl
Copy link
Contributor Author

hawkowl commented Jun 27, 2018

@erikjohnston it returning bare values feels like it's only working on accident, tbh :S

@erikjohnston
Copy link
Member

We so consistently use inlineCallbacks that it'd be fine. Though I agree its fairly awful

@hawkowl
Copy link
Contributor Author

hawkowl commented Jun 27, 2018

@erikjohnston it hid a bug in push_bulk_rules, where it didn't yield, only called, and relied on there being a cached value!

@hawkowl
Copy link
Contributor Author

hawkowl commented Jun 27, 2018

(which meant anything that called this made the tests fail as it was expecting a value, not a deferred)

@richvdh
Copy link
Member

richvdh commented Jul 4, 2018

As Erik has said, this was somewhat deliberate: see #2075 which made it so. It's also worth noting that CacheListDescriptor's docstring makes this explicit, though apparently when I retrofitted that docstring I didn't also do the same for CacheDescriptor.

I do agree that an inconsistent return type is horrific and a source of fragility like this, though if Erik's claims on #2075 are to be believed, that may be outweighed by the performance hit.

On the other hand, I don't really understand why it makes so much difference. Surely the overhead of a completed Deferred should be negligible? It means that the next level up does a bit of extra work, but it's really not much.

In conclusion, I guess we should decide how much of a performance hit this would cause. If it's negligible, then I am very happy for us to start unwinding #2075 and go for consistent return types not only in CacheDescriptor, but also in CacheListDescriptor and ObservableDeferred.

@richvdh
Copy link
Member

richvdh commented Jul 4, 2018

[alternatively, let's just fix the bug in push_bulk_rules and move on.]

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

needs more thought as above

@hawkowl
Copy link
Contributor Author

hawkowl commented Jul 4, 2018

I'll have a bit more of a think about this when the async/await stuff comes to a head.

@hawkowl hawkowl closed this Jul 4, 2018
@hawkowl hawkowl deleted the hawkowl/deferred-cache branch September 20, 2018 13:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants