This is an archive of the discontinued Mercurial Phabricator instance.

setdiscovery: access future.result() inside command executor
ClosedPublic

Authored by martinvonz on Sep 20 2018, 12:32 AM.

Details

Summary

peer.commandexecutor()'s context manager waits for all responses to
arrive in its exit() method. When batching requests, one often
wants to process the requests as they arrive. That means one has to
call future.result() before exiting the command executor's context
manager. It doesn't matter in practice here (where we batch only
"heads" and "known" and don't care to process either until both
responses have arrived), but let's make this code a good example for
others who may want to copy the pattern.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Sep 20 2018, 12:32 AM
This revision was automatically updated to reflect the committed changes.

I'm going to drop this from hg-committed because it introduces deadlock in test-http-bad-server.t.

The deadlock is due to buggy future handling in (at least) httppeer. I'll keep this patch in my local queue and will try to hack on a fix for the peer.