forked from fair/matrix-puppeteer-line
Retry sending messages if server returns 502
This commit is contained in:
parent
d32e3819b0
commit
ded551d1b3
|
@ -16,10 +16,8 @@
|
||||||
from typing import Any, List, NamedTuple
|
from typing import Any, List, NamedTuple
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from mautrix.types import UserID
|
from mautrix.util.config import ConfigUpdateHelper, ForbiddenDefault
|
||||||
from mautrix.client import Client
|
from mautrix.bridge.config import BaseBridgeConfig
|
||||||
from mautrix.bridge.config import (BaseBridgeConfig, ConfigUpdateHelper, ForbiddenKey,
|
|
||||||
ForbiddenDefault)
|
|
||||||
|
|
||||||
Permissions = NamedTuple("Permissions", user=bool, admin=bool, level=str)
|
Permissions = NamedTuple("Permissions", user=bool, admin=bool, level=str)
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ from mautrix.types import (EventID, MessageEventContent, RoomID, EventType, Mess
|
||||||
ContentURI, EncryptedFile)
|
ContentURI, EncryptedFile)
|
||||||
from mautrix.errors import MatrixError
|
from mautrix.errors import MatrixError
|
||||||
from mautrix.util.simple_lock import SimpleLock
|
from mautrix.util.simple_lock import SimpleLock
|
||||||
|
from mautrix.util.network_retry import call_with_net_retry
|
||||||
|
|
||||||
from .db import Portal as DBPortal, Message as DBMessage
|
from .db import Portal as DBPortal, Message as DBMessage
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
@ -185,8 +186,8 @@ class Portal(DBPortal, BasePortal):
|
||||||
upload_mime_type = "application/octet-stream"
|
upload_mime_type = "application/octet-stream"
|
||||||
upload_file_name = None
|
upload_file_name = None
|
||||||
|
|
||||||
mxc = await intent.upload_media(data, mime_type=upload_mime_type,
|
mxc = await call_with_net_retry(intent.upload_media, data, mime_type=upload_mime_type,
|
||||||
filename=upload_file_name)
|
filename=upload_file_name, _action="upload media")
|
||||||
|
|
||||||
if decryption_info:
|
if decryption_info:
|
||||||
decryption_info.url = mxc
|
decryption_info.url = mxc
|
||||||
|
|
|
@ -4,7 +4,7 @@ commonmark>=0.8,<0.10
|
||||||
aiohttp>=3,<4
|
aiohttp>=3,<4
|
||||||
yarl>=1,<2
|
yarl>=1,<2
|
||||||
attrs>=19.1
|
attrs>=19.1
|
||||||
mautrix==0.8.0rc4
|
mautrix>=0.8.2,<0.9
|
||||||
asyncpg>=0.20,<0.22
|
asyncpg>=0.20,<0.22
|
||||||
pillow>=4,<8
|
pillow>=4,<8
|
||||||
qrcode>=6,<7
|
qrcode>=6,<7
|
||||||
|
|
Loading…
Reference in New Issue