Change db query interval
This commit is contained in:
parent
7eb6cb0b86
commit
8918d732d1
1 changed files with 4 additions and 3 deletions
|
@ -48,7 +48,7 @@ async def on_ready():
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
||||||
# Schedule a database update
|
# Schedule a database update
|
||||||
scheduler.add_job(func=query_database, trigger='interval', seconds=30, id='query_database')
|
scheduler.add_job(func=query_database, trigger='interval', seconds=15, id='query_database')
|
||||||
scheduler.get_job('query_database').modify(next_run_time=datetime.now())
|
scheduler.get_job('query_database').modify(next_run_time=datetime.now())
|
||||||
|
|
||||||
@bot.command(name='hello', help='Say hello to the bot')
|
@bot.command(name='hello', help='Say hello to the bot')
|
||||||
|
@ -118,7 +118,7 @@ async def stop(ctx):
|
||||||
# Check if the recorder job already exists
|
# Check if the recorder job already exists
|
||||||
if recorder:
|
if recorder:
|
||||||
await ctx.channel.send(f'Shutting down recorder...')
|
await ctx.channel.send(f'Shutting down recorder...')
|
||||||
# kill any process currently running
|
# TODO: kill any process currently running
|
||||||
recorder = False
|
recorder = False
|
||||||
else:
|
else:
|
||||||
await ctx.channel.send(f'Recorder is already stopped.')
|
await ctx.channel.send(f'Recorder is already stopped.')
|
||||||
|
@ -160,12 +160,13 @@ async def query_database():
|
||||||
logger_discord.error('Database is empty!')
|
logger_discord.error('Database is empty!')
|
||||||
return
|
return
|
||||||
|
|
||||||
# Search for live streams and announce them
|
# Search for streams and announce them
|
||||||
for key, value in database.items():
|
for key, value in database.items():
|
||||||
stream_name = value['name']
|
stream_name = value['name']
|
||||||
stream_start_at = value['start_at']
|
stream_start_at = value['start_at']
|
||||||
stream_details = value['details']
|
stream_details = value['details']
|
||||||
if stream_start_at == 'now':
|
if stream_start_at == 'now':
|
||||||
|
# Announce live streams
|
||||||
# Check if the announement job already exists
|
# Check if the announement job already exists
|
||||||
if scheduler.get_job('announce_live_channel') is None:
|
if scheduler.get_job('announce_live_channel') is None:
|
||||||
# Job doesn't exist, so add it
|
# Job doesn't exist, so add it
|
||||||
|
|
Loading…
Add table
Reference in a new issue