interval = int(round(msg_num/3)) qs1= NewsletterMsgActive.objects.order_by('id')[:interval] t1 = Worker(qs1) t1.run() qs2= NewsletterMsgActive.objects.order_by('id')[interval:interval*2] t2 = Worker(qs2) t2.run() qs3= NewsletterMsgActive.objects.order_by('id')[interval*3:] t3 = Worker(qs3) t3.run() while not t1.complete or not t1.complete or not t3.complete: time.sleep(5)
хе хе