runtime
373 / 500
question 373 Threading & Multiprocessing · easy

Send notifications in batches of threads

The SMS provider allows at most batch_size requests at once. Write notify_in_batches(customers, send, batch_size, make_thread=threading.Thread): start one thread per customer for the first batch_size customers, join them all, then do the next batch, and so on.

Read and diagnose: this can't run in the browser, so you'll read real code and output and answer questions about it.

Functionnotify_in_batches(customers, send, batch_size, make_thread=threading.Thread)
Rulewithin a batch, start every thread before joining any; never start the next batch before the current one is joined
Returnsthe number of batches run

Loading your progress…

Send notifications in batches of threads — Python practice · Runtime