Skip to content

Add multi-send #84

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

Merged
merged 5 commits into from
May 13, 2020
Merged

Add multi-send #84

merged 5 commits into from
May 13, 2020

Conversation

lukechurch
Copy link
Member

@as2388 I'd like to add something like this to the code. The testing is going to be pretty laborious - so if you could take a look at the direction to see if you want something different before I start testing that would be great.

I've written it on the basis that we might want to deprecate and remove the 'send to single' API which will make it consistent with the interrupt API we surface.

If you're ok with this, I'll send you a proper PR after I'm done with testing and any changes needed

@lukechurch lukechurch requested a review from as2388 May 13, 2020 11:15
@lukechurch lukechurch marked this pull request as ready for review May 13, 2020 16:44
Copy link
Member

@as2388 as2388 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

log.info(f"Sending a message to {len(urns)} URNs...")
log.debug(f"Sending to {urns}...")
batch = []
ids = []
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ids = []
broadcast_ids = []

I read this as contact ids at first

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, thanks

interrupted += len(batch)
log.info(f"Interrupted {interrupted} / {len(urns)} URNs")

response: Broadcast = self.rapid_pro.create_broadcast(message, urns=batch)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should remove the : Broadcast to avoid future confusion, as we're not using type hinting anywhere else

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do

Comment on lines 323 to 324
log.info(f"Interrupted {interrupted} / {len(urns)} URNs")
log.info(f"Sent {sent} / {len(urns)} URNs")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe push these into the if to avoid double printing e.g. 200/200 if the number of requested urns is divisible by 100

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, thanks!

@lukechurch lukechurch merged commit 1b4a1a1 into master May 13, 2020
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.

2 participants