y9san9 / prizebot

Open source telegram bot to purely raffle prizes (giveaways) with random.org written in Kotlin
https://t.me/y9prizebot
MIT License
76 stars 13 forks source link

Optimize giveaway scheduling #96

Open y9san9 opened 3 years ago

y9san9 commented 3 years ago

For now every scheduled giveaway produces a coroutine attached to it. The goal of the issue is to make this only with one coroutine and shared flow. Idea is to launch only one coroutine with the earliest giveaway and after schedule it, launch another coroutine with giveaways later.

Example: I'm scheduling giveaway in two days, bot launches coroutine since it is first schedule, next person then launches it's giveaway in one day, so my coroutine will be cancelled and his coroutine with one day delay will be started.