refactor(bot): ♻️ Replace % with , in logging calls.
This commit is contained in:
@@ -34,7 +34,7 @@ def shard(
|
||||
bot.shutdown = shutdown
|
||||
bot.scheduled_shutdown = scheduled_shutdown
|
||||
|
||||
log.info("Running shard %s with default loop." % shard_id)
|
||||
log.info("Running shard %s with default loop.", shard_id)
|
||||
bot.run(config.TOKEN)
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ if __name__ == "__main__":
|
||||
shutdown = manager.Value("b", False)
|
||||
scheduled_shutdown = manager.Value("b", False)
|
||||
|
||||
log.info("Starting %s shards." % shard_count)
|
||||
log.info("Starting %s shards.", shard_count)
|
||||
|
||||
ps: list[mp.Process] = [
|
||||
mp.Process(
|
||||
@@ -119,13 +119,11 @@ if __name__ == "__main__":
|
||||
for i, p in enumerate(ps):
|
||||
p.start()
|
||||
|
||||
log.info("Shard %s's process started.", i)
|
||||
log.info(
|
||||
f"Shard {i}'s process started."
|
||||
+ (
|
||||
" Waiting 5 seconds start initialize next shard..."
|
||||
if i != len(ps) - 1
|
||||
else " All shards were started."
|
||||
)
|
||||
"Waiting 5 seconds start initialize next shard..."
|
||||
if i != len(ps) - 1
|
||||
else "All shards were started."
|
||||
)
|
||||
|
||||
if i != len(ps) - 1:
|
||||
@@ -144,9 +142,7 @@ if __name__ == "__main__":
|
||||
|
||||
for i in range(shard_count):
|
||||
if not ps[i].is_alive():
|
||||
log.warning(
|
||||
"Shard %s's process exited. Restarting the shard..." % s
|
||||
)
|
||||
log.warning("Shard %s's process exited. Restarting the shard...", i)
|
||||
|
||||
ps[i] = mp.Process(
|
||||
target=shard,
|
||||
@@ -161,8 +157,8 @@ if __name__ == "__main__":
|
||||
ps[i].start()
|
||||
|
||||
log.info(
|
||||
"Shard %s was restarted. Waiting 5 seconds to check next shard..."
|
||||
% i
|
||||
"Shard %s was restarted. Waiting 5 seconds to check next shard...",
|
||||
i,
|
||||
)
|
||||
time.sleep(5)
|
||||
|
||||
@@ -183,11 +179,11 @@ if __name__ == "__main__":
|
||||
log.info("A shard shut down the bot.")
|
||||
|
||||
finally:
|
||||
log.info("Terminating %s shards..." % shard_count)
|
||||
log.info("Terminating %s shards...", shard_count)
|
||||
|
||||
for i, p in enumerate(ps):
|
||||
p.terminate()
|
||||
log.info("Terminated shard %s." % i)
|
||||
log.info("Terminated shard %s.", i)
|
||||
|
||||
log.info("Stopping messages flushing process...")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user