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

sdk/agent: make open, payment, close consistently async or sync #224

Closed
leighmcculloch opened this issue Jul 30, 2021 · 0 comments · Fixed by #241
Closed

sdk/agent: make open, payment, close consistently async or sync #224

leighmcculloch opened this issue Jul 30, 2021 · 0 comments · Fixed by #241
Assignees

Comments

@leighmcculloch
Copy link
Contributor

The open, payment, and close functionality introduced for #217 (pr #221) is not consistent about whether it is synchronous or asynchronous. For example, the open is asynchronous, the payment is asynchronous, but the close is synchronous. This is confusing.

There are arguments both ways for synchronous or asynchronous. And synchronous behavior can always be made asynchronous, and asynchronous behavior can always be made synchronous. Typically the former is easier, however there is no guarantee that replies from remote participants are instantaneous, which leads me to think we should develop asynchronous functionality, even if it is a little more complex.

Therefore, I think all the functions should probably be asynchronous, except when submitting txs to the network since Horizon limits us to synchronous submission until something like stellar/go#3564 is implemented.

  • Open() should return immediately after sending the remote participant the open proposal and the result of the open should be returned to the application through an event handler.
  • Payment() should continue to be asynchronous as it is today.
  • Close() should return immediately sending the remote participant the close proposal after getting a successful declaration tx submission to network.
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 a pull request may close this issue.

1 participant