Make forward backfill timeout configurable
This commit is contained in:
@@ -194,6 +194,7 @@ class Config(BaseBridgeConfig):
|
||||
copy("bridge.backfill.forward_limits.sync.normal_group")
|
||||
copy("bridge.backfill.forward_limits.sync.supergroup")
|
||||
copy("bridge.backfill.forward_limits.sync.channel")
|
||||
copy("bridge.backfill.forward_timeout")
|
||||
copy("bridge.backfill.incremental.messages_per_batch")
|
||||
copy("bridge.backfill.incremental.post_batch_delay")
|
||||
copy("bridge.backfill.incremental.max_batches.user")
|
||||
|
||||
@@ -420,6 +420,8 @@ bridge:
|
||||
normal_group: 100
|
||||
supergroup: 100
|
||||
channel: 100
|
||||
# Timeout for forward backfills in seconds. If you have a high limit, you'll have to increase this too.
|
||||
forward_timeout: 900
|
||||
|
||||
# Settings for incremental backfill of history. These only apply when using MSC2716.
|
||||
incremental:
|
||||
|
||||
@@ -2885,13 +2885,15 @@ class Portal(DBPortal, BasePortal):
|
||||
)
|
||||
if limit == 0:
|
||||
return "Limit is zero, not backfilling"
|
||||
timeout = self.config["bridge.backfill.forward_timeout"]
|
||||
with self.backfill_lock:
|
||||
output = await asyncio.wait_for(
|
||||
self.backfill(
|
||||
source, client, forward=True, forward_limit=limit, last_tgid=last_tgid
|
||||
),
|
||||
timeout=15 * 60,
|
||||
task = self.backfill(
|
||||
source, client, forward=True, forward_limit=limit, last_tgid=last_tgid
|
||||
)
|
||||
if timeout > 0:
|
||||
output = await asyncio.wait_for(task, timeout=timeout)
|
||||
else:
|
||||
output = await task
|
||||
self.log.debug(f"Forward backfill complete, status: {output}")
|
||||
return output
|
||||
|
||||
|
||||
Reference in New Issue
Block a user