mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-31 01:19:36 +00:00
Fix mnt task min usage with an empty iterable
This commit is contained in:
@@ -466,10 +466,12 @@ class Twitch:
|
||||
# 1h at max, but can be shorter if there's an upcoming campaign earlier than that
|
||||
# divide the period into up to two evenly spaced checks (usually ~15-30m)
|
||||
now = datetime.now(timezone.utc)
|
||||
one_hour = timedelta(hours=1)
|
||||
period = min(
|
||||
campaign.starts_at - now for campaign in self.inventory if campaign.starts_at > now
|
||||
(campaign.starts_at - now for campaign in self.inventory if campaign.starts_at > now),
|
||||
default=one_hour,
|
||||
)
|
||||
if period > (one_hour := timedelta(hours=1)):
|
||||
if period > one_hour:
|
||||
period = one_hour
|
||||
times = ceil(period.total_seconds() / 30 * 60)
|
||||
period /= times
|
||||
|
||||
Reference in New Issue
Block a user