fix (schedule): Various bug fixes.
This commit is contained in:
@@ -489,7 +489,8 @@ class ScheduleCog(LionCog):
|
||||
session = slot.sessions.get(guildid, None)
|
||||
if session is None:
|
||||
# Create a new session in the slot and set it up
|
||||
session = await slot.load_sessions(session_data[guildid, slotid])
|
||||
sessions = await slot.load_sessions([session_data[guildid, slotid]])
|
||||
session = sessions[guildid]
|
||||
slot.sessions[guildid] = session
|
||||
if slot.closing.is_set():
|
||||
# This should never happen
|
||||
|
||||
@@ -210,20 +210,21 @@ class TimeSlot:
|
||||
await batchrun_per_second(coros, 5)
|
||||
|
||||
# Save messageids
|
||||
tmptable = TemporaryTable(
|
||||
'_gid', '_sid', '_mid',
|
||||
types=('BIGINT', 'INTEGER', 'BIGINT')
|
||||
)
|
||||
tmptable.values = [
|
||||
(sg.data.guildid, sg.data.slotid, sg.messageid)
|
||||
for sg in sessions
|
||||
if sg.messageid is not None
|
||||
]
|
||||
await Data.ScheduleSession.table.update_where(
|
||||
guildid=tmptable['_gid'], slotid=tmptable['_sid']
|
||||
).set(
|
||||
messageid=tmptable['_mid']
|
||||
).from_expr(tmptable)
|
||||
if sessions:
|
||||
tmptable = TemporaryTable(
|
||||
'_gid', '_sid', '_mid',
|
||||
types=('BIGINT', 'INTEGER', 'BIGINT')
|
||||
)
|
||||
tmptable.values = [
|
||||
(sg.data.guildid, sg.data.slotid, sg.messageid)
|
||||
for sg in sessions
|
||||
if sg.messageid is not None
|
||||
]
|
||||
await Data.ScheduleSession.table.update_where(
|
||||
guildid=tmptable['_gid'], slotid=tmptable['_sid']
|
||||
).set(
|
||||
messageid=tmptable['_mid']
|
||||
).from_expr(tmptable)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
f"Unhandled exception while preparing timeslot <slotid: {self.slotid}>."
|
||||
|
||||
Reference in New Issue
Block a user