Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Add withTimeout to Chat and Offline Messages #1455

Merged
merged 3 commits into from
Feb 25, 2019
Merged

Conversation

hoffmabc
Copy link
Member

Helps fix #1224

@hoffmabc hoffmabc added the feature Feature or enhancement to openbazaar-go label Feb 20, 2019
@hoffmabc hoffmabc self-assigned this Feb 20, 2019
@coveralls
Copy link

coveralls commented Feb 20, 2019

Coverage Status

Coverage remained the same at 34.836% when pulling 909e269 on fix-chat-timeouts into 7df4799 on master.

Copy link
Member

@placer14 placer14 left a comment

Choose a reason for hiding this comment

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

LGTM

@hoffmabc hoffmabc changed the title Add withTimeout to Chat and Group Messages Add withTimeout to Chat and Offline Messages Feb 20, 2019
@hoffmabc
Copy link
Member Author

cc: @drwasho

@placer14 @cpacia please take a closer look at this as I added some more timeouts to offline messaging. The reason for this is that mobile is also having trouble with offline timeouts related to purchases. I've tested this locally on desktop and it seems to be performing as intended, but I'm not sure if you guys will find side effects this may impact.

Below are two purchase calls that are hitting the 5s limit (modified the start for desktop to use 5s) and falling through.

image

image

core/net.go Outdated
@@ -96,7 +96,7 @@ func (n *OpenBazaarNode) SendOfflineMessage(p peer.ID, k *libp2p.PubKey, m *pb.M
log.Debugf("Sending offline message to: %s, Message Type: %s, PointerID: %s, Location: %s", p.Pretty(), m.MessageType.String(), pointer.Cid.String(), pointer.Value.Addrs[0].String())
OfflineMessageWaitGroup.Add(2)
go func() {
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), n.OfflineMessageFailoverTimeout)
Copy link
Member

Choose a reason for hiding this comment

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

Since this is in a separate goroutine I don't think we need a timeout here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are we good on the other ones?

Copy link
Member

Choose a reason for hiding this comment

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

I think the other ones are OK. If you remove this one we can merge.

@hoffmabc
Copy link
Member Author

GTG @cpacia

@cpacia cpacia merged commit 66511e8 into master Feb 25, 2019
@placer14 placer14 deleted the fix-chat-timeouts branch March 21, 2019 22:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
⏰ changes requested feature Feature or enhancement to openbazaar-go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API calls where messages are sent to offline stores exceeding intended timeouts
4 participants