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

orderwatch: Use consistent asynchronous API #307

Merged
merged 5 commits into from
Jul 29, 2019

Conversation

albrow
Copy link
Contributor

@albrow albrow commented Jul 25, 2019

related to #96.

@@ -112,9 +112,6 @@ func SetupOrderStream(ctx context.Context, app *core.App) (*ethRpc.Subscription,

for {
select {
case <-ctx.Done():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes a bug in #304 that was previously unnoticed. ctx here is not something we control and it seems to be canceled even though a client is still actively subscribed. I can't find any documentation about the expected behavior of ctx at https://godoc.org/github.com/ethereum/go-ethereum/rpc. For now, we have no real choice but to ignore the given context.

FillableTakerAssetAmount: orderInfo.FillableTakerAssetAmount,
Kind: zeroex.EKOrderExpired,
}
w.orderFeed.Send([]*zeroex.OrderEvent{orderEvent})
Copy link
Contributor

@fabioberger fabioberger Jul 26, 2019

Choose a reason for hiding this comment

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

An optimization here would be to append each OrderEvent to a slice and then send them all to orderFeed after the for loop has finished executing.

@albrow albrow force-pushed the feature/orderwatch-consistent-async-api branch from 8a1ee5b to 41fffa6 Compare July 26, 2019 22:46
logger.WithFields(logger.Fields{
"error": err.Error(),
"orderHash": expiredOrder.ID,
}).Warning("Order expired that was no longer in DB")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep this as a Warning or lower this to a Trace? It is expected to happen from time to time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Good idea.

@albrow albrow merged commit 85a6b90 into development Jul 29, 2019
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.

2 participants