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

Allow array of URIs when creating shovel #688

Merged
merged 4 commits into from
Jun 17, 2024
Merged

Conversation

kickster97
Copy link
Member

@kickster97 kickster97 commented May 31, 2024

WHAT is this pull request doing?

Allows for multiple URIs to be sent in when creating a shovel. This input can now be either a string, or an array of strings. If more than one uri string is provided, the shovel will randomly pick one URI from the list until one of the endpoints succeeds.
Needed for compatibility with clients

still needs some small adjustments

HOW can this pull request be tested?

Try to create a shovel and send in multiple uris

@kickster97 kickster97 changed the title add destinationWrapper and allow multiple uris for creating shovel Allow array of URIs when creating shovel May 31, 2024
@kickster97 kickster97 marked this pull request as draft May 31, 2024 11:22
@kickster97 kickster97 marked this pull request as ready for review June 5, 2024 14:27
Copy link
Member

@spuun spuun left a comment

Choose a reason for hiding this comment

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

Minor comments but nothing that must be fixed.

src/lavinmq/shovel/shovel_store.cr Outdated Show resolved Hide resolved
@@ -8,6 +8,13 @@ module LavinMQ

forward_missing_to @shovels

def parse_uris(src_uri) : Array(URI)
uris = src_uri.as_s? ? [src_uri.as_s] : src_uri.as_a.map(&.as_s)
Copy link
Member

Choose a reason for hiding this comment

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

This could probably be

Suggested change
uris = src_uri.as_s? ? [src_uri.as_s] : src_uri.as_a.map(&.as_s)
uris = src_uri.as_s? || src_uri.as_a.map(&.as_s)

Copy link
Member Author

Choose a reason for hiding this comment

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

does not work for map,
undefined method 'map' for String (compile-time type is (Array(String) | String))

src/lavinmq/shovel/shovel.cr Outdated Show resolved Hide resolved
@kickster97 kickster97 merged commit 5dd5049 into main Jun 17, 2024
16 of 19 checks passed
@kickster97 kickster97 deleted the allow_mulitple_uri_shovel branch June 17, 2024 11:15
viktorerlingsson pushed a commit that referenced this pull request Sep 20, 2024
* add destinationWrapper and allow multiple uris for creating shovel
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 this pull request may close these issues.

3 participants