python - How should a Twisted AMP Deferred be cancelled? -


i have twisted client/server application client asks multiple servers additional work done using amp. first server respond client wins -- other outstanding client requests should cancelled.

deferred objects support cancel() , cancellor function may passed deferred's constructor. however, amp's sendremote() api doesn't support passing cancellor function. additionally, i'd want cancellor function not stop local request processing upon completion remove request remote server.

amp's boxdispatcher have stopreceivingboxes method, causes deferreds error out (not quite want).

is there way cancel amp requests?

no. there no way, presently, cancel amp request.

you can't cancel amp requests because there no way defined in amp @ wire-protocol level send message remote server telling stop processing. interesting feature-addition amp, if added, not add allowing users pass in own cancellers; rather, amp have create cancellation function sent "cancel" command.

finally, adding feature have done because once request sent, there's no guarantee not have been processed; chances time cancellation request received , processed remote end, remote end has finished processing , sent reply. amp should implement asynchronous cancellation.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -