fix: Adjust memory threshold for Discord message sending to improve reliability
This commit is contained in:
parent
697f0bf31e
commit
3b7982a3a3
4
main.py
4
main.py
@ -207,7 +207,7 @@ if wifi and wifi.isconnected():
|
|||||||
|
|
||||||
# Try sending Discord webhook NOW, before creating other objects
|
# Try sending Discord webhook NOW, before creating other objects
|
||||||
gc.collect()
|
gc.collect()
|
||||||
mem_ok = gc.mem_free() > 140000
|
mem_ok = gc.mem_free() > 120000
|
||||||
if mem_ok:
|
if mem_ok:
|
||||||
ok = discord_webhook.send_discord_message("Pico W online at http://{}".format(ifconfig[0]), debug=False)
|
ok = discord_webhook.send_discord_message("Pico W online at http://{}".format(ifconfig[0]), debug=False)
|
||||||
if ok:
|
if ok:
|
||||||
@ -416,7 +416,7 @@ while True:
|
|||||||
import gc as _gc # type: ignore
|
import gc as _gc # type: ignore
|
||||||
_gc.collect()
|
_gc.collect()
|
||||||
_gc.collect()
|
_gc.collect()
|
||||||
mem_ok = getattr(_gc, 'mem_free', lambda: 0)() > 140000
|
mem_ok = getattr(_gc, 'mem_free', lambda: 0)() > 120000
|
||||||
if mem_ok:
|
if mem_ok:
|
||||||
try:
|
try:
|
||||||
ok = discord_webhook.send_discord_message(pending_discord_message, debug=False)
|
ok = discord_webhook.send_discord_message(pending_discord_message, debug=False)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user