File tree Expand file tree Collapse file tree 1 file changed +1
-19
lines changed Expand file tree Collapse file tree 1 file changed +1
-19
lines changed Original file line number Diff line number Diff line change 5
5
from fastapi import FastAPI , APIRouter
6
6
from fastapi .middleware .cors import CORSMiddleware
7
7
8
- from . import settings
8
+ from backend import settings
9
9
10
10
logger = logging .getLogger (__name__ )
11
11
20
20
TELEGRAM_WEBHOOK_URL = f"{ settings .BASE_DOMAIN } /webhook"
21
21
22
22
23
- def retry_after (seconds : int ):
24
- def decorator (func ):
25
- async def wrapper (* args , ** kwargs ):
26
- result = False
27
- while not result :
28
- try :
29
- await func (* args , ** kwargs )
30
- result = True
31
- except Exception as e :
32
- logger .error (f"Error while processing message: { e } " )
33
- logger .info (f"Retrying after { seconds } seconds" )
34
- await asyncio .sleep (seconds )
35
-
36
- return wrapper
37
-
38
- return decorator
39
-
40
-
41
23
@webhook_api_router .post ("/webhook" )
42
24
async def telegram_webhook (request : dict ):
43
25
update = types .Update (** request )
You can’t perform that action at this time.
0 commit comments