GeezerVison is showing github.com — 'Connection.lookup' can return 'missing' and 'deferred' results · Issue #306 · googleapis/google-cloud-python
'Connection.lookup' can return 'missing' and 'deferred' results #306Activitytseaver commented on Oct 28, 2014 ContributorAuthor More actions Options:
- Have the user pass optional
missing and / or deferred lists into lookup(), and populate them IFF they are not None.
- Change
lookup() to always return a three-tuple, (found, missing, deferred), where each item is a list (of entities, key-only entities, and keys, respectively).
dhermes commented on Oct 28, 2014 I prefer the first option or just a different verb like fetch() versus fetch_page() with ndb. silvolu commented on Oct 28, 2014 IRT "do we need to support", they come quite cheap in the end, so it'd be good to have them.
@pcostell, out of curiosity, how likely is that deferred contains results?
I don't have any strong opinions about your proposals. pcostell commented on Oct 28, 2014 A small percentage of responses have deferred results. The field will only be populated if there were too many keys requested or the result size was too large. I would consider reissuing a lookup to get any deferred keys under the hood so that the user just gets all the results they requested. silvolu commented on Oct 28, 2014 dhermes commented on Oct 28, 2014 I do too, with the caveat that we should let people pass in a boolean to disable the "more RPCs without telling the user" behavior and under that flag we could return the keys that were deferred? tseaver commented on Dec 17, 2014 ContributorAuthor More actions Can we have the value passed in to disable extra under-the-covers RPCs be a list, into which the contents of the deferred field from the response would be copied? We could handle missing similarly. E.g.:
deferred = []
missing = []
entities = con.lookup(dataset_id, key_pbs, deferred=deferred, missing=missing)
If deferred isn't a list, then we do the "try again" dance as suggested by @pcostell. If missing isn't a list, then we just ignore it (the status quo). silvolu commented on Dec 17, 2014 dhermes commented on Dec 17, 2014 Yes I like this approach. Simple and convenient. tseaver commented on Dec 17, 2014 ContributorAuthor More actions @pcostell wrote:
I would consider reissuing a lookup to get any deferred keys under the hood so that the user
just gets all the results they requested.
Should the code sleep for some interval before retrying the deferred keys? pcostell commented on Dec 17, 2014 No need to sleep. There were just too many results in that request.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|