Introduce delay to reduce CPU usage

- Telegram "long polling" is a lie :'(
This commit is contained in:
Davide Depau 2018-02-25 20:20:37 +01:00
parent f7e451da30
commit b88af98e43
Signed by: depau
GPG Key ID: C7D999B6A55EFE86
1 changed files with 2 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import sys, random import sys, random
import traceback import traceback
from datetime import time
from typing import Sequence, AnyStr from typing import Sequence, AnyStr
from depytg import types, methods, errors from depytg import types, methods, errors
@ -94,6 +95,7 @@ def main():
try: try:
while True: while True:
prev_offset = mainloop(token, prev_offset) + 1 prev_offset = mainloop(token, prev_offset) + 1
time.sleep(0.2)
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass