Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: delay when using lightpush #4462

Closed
chaitanyaprem opened this issue Dec 14, 2023 · 1 comment · Fixed by #4466
Closed

bug: delay when using lightpush #4462

chaitanyaprem opened this issue Dec 14, 2023 · 1 comment · Fixed by #4466
Assignees

Comments

@chaitanyaprem
Copy link
Contributor

Problem

Observed the below while dogfooding status-desktop using lightpush.

If a single message is sent , message is delivered almost instantly
When multiple messages are sent in succession, then a significant delay in message delivery is observed which keeps increasing with each mesage sent.

Implementation

On debugging further noticed that in status-go, a single queue which sends a message via lightpush and waits for response from lightpush node before next message is sent. This is causing the significant delay in delivery.
ref code:

status-go/wakuv2/waku.go

Lines 1028 to 1037 in b52a9ce

case envelope := <-w.sendQueue:
pubsubTopic := envelope.PubsubTopic()
var err error
logger := w.logger.With(zap.String("envelopeHash", hexutil.Encode(envelope.Hash())), zap.String("pubsubTopic", pubsubTopic), zap.String("contentTopic", envelope.Message().ContentTopic), zap.Int64("timestamp", envelope.Message().GetTimestamp()))
// For now only used in testing to simulate going offline
if w.settings.SkipPublishToTopic {
err = errors.New("Test send failure")
} else if w.settings.LightClient {
w.logger.Info("publishing message via lightpush")
_, err = w.node.Lightpush().Publish(w.ctx, envelope.Message(), lightpush.WithPubSubTopic(pubsubTopic))
.

This needs to be done asynchronously in order to avoid the delay observed while using lightpush.

Quoting @richard-ramos I guess that code could be put into a goroutine. The important part is to call w.SendEnvelopeEvent(event) after the message is sent indicating if it was sent succesfully or not

Acceptance Criteria

When using lightMode, sending messages in succession should not have delay in delivering the same.

Future Steps

Ensure all lightpush related tests pass.
Need to ensure to test cases where there is a lot of network connectivity, messages to be sent are either sent successfully or marked for resend.

@chair28980
Copy link

chair28980 commented Dec 14, 2023

Addressed in #4466 (develop branch) and #4467 (test-shard-test release branch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants