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

fix: rest get messages not returning more than 1 message #898

Merged
merged 3 commits into from
Nov 14, 2023

Conversation

chaitanyaprem
Copy link
Collaborator

@chaitanyaprem chaitanyaprem commented Nov 14, 2023

Description

Getting relay messages via REST API was not working correctly as it would only return a single message due to having a select with a default case without having a loop to drain the channel.

Changes

  • Added a loop to drain the channel until cacheCapacity or context is done
  • Increase default relay cache capacity

Tests

Tested locally using default pubsubtopic and noticed that messages were returned until channel is drained.

@status-im-auto
Copy link

status-im-auto commented Nov 14, 2023

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ e1b7359 #1 2023-11-14 06:03:54 ~2 min nix-flake 📄log
✔️ e1b7359 #1 2023-11-14 06:04:15 ~2 min linux 📦deb
✔️ e1b7359 #1 2023-11-14 06:05:11 ~3 min tests 📄log
✔️ e1b7359 #1 2023-11-14 06:05:34 ~3 min tests 📄log
✔️ e1b7359 #1 2023-11-14 06:05:56 ~4 min android 📦tgz
✔️ e1b7359 #1 2023-11-14 06:06:43 ~5 min ios 📦tgz
✔️ c2e7ed7 #2 2023-11-14 15:05:55 ~1 min nix-flake 📄log
✔️ c2e7ed7 #2 2023-11-14 15:06:26 ~2 min linux 📦deb
✔️ c2e7ed7 #2 2023-11-14 15:07:58 ~3 min tests 📄log
✔️ c2e7ed7 #2 2023-11-14 15:08:03 ~3 min tests 📄log
✔️ c2e7ed7 #2 2023-11-14 15:08:12 ~4 min android 📦tgz
✔️ c2e7ed7 #4 2023-11-14 17:23:45 ~17 min ios 📦tgz

select {
case envelope, open := <-sub.Ch:
if !open {
r.log.Error("consume channel is closed for subscription", zap.String("pubsubTopic", topic))

Check failure

Code scanning / CodeQL

Log entries created from user input High

This log entry depends on a
user-provided value
.
Copy link
Member

@richard-ramos richard-ramos left a comment

Choose a reason for hiding this comment

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

Nice. I'll close the other PR since this is simpler!

@richard-ramos richard-ramos merged commit 8122cf4 into master Nov 14, 2023
11 of 12 checks passed
@richard-ramos richard-ramos deleted the fix/rest-get-messages branch November 14, 2023 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants