Don't try to backfill if limit is zero
This commit is contained in:
@@ -355,6 +355,9 @@ bridge:
|
|||||||
normal_groups: false
|
normal_groups: false
|
||||||
|
|
||||||
# Forward backfilling limits. These apply to both MSC2716 and legacy backfill.
|
# Forward backfilling limits. These apply to both MSC2716 and legacy backfill.
|
||||||
|
#
|
||||||
|
# Using a negative initial limit is not recommended, as it would try to backfill everything in a single batch.
|
||||||
|
# MSC2716 and the incremental settings are meant for backfilling everything incrementally rather than at once.
|
||||||
forward:
|
forward:
|
||||||
# Number of messages to backfill immediately after creating a portal.
|
# Number of messages to backfill immediately after creating a portal.
|
||||||
initial_limit: 10
|
initial_limit: 10
|
||||||
|
|||||||
@@ -2646,6 +2646,8 @@ class Portal(DBPortal, BasePortal):
|
|||||||
) -> str:
|
) -> str:
|
||||||
type = "initial" if initial else "sync"
|
type = "initial" if initial else "sync"
|
||||||
limit = override_limit or self.config[f"bridge.backfill.forward.{type}_limit"]
|
limit = override_limit or self.config[f"bridge.backfill.forward.{type}_limit"]
|
||||||
|
if limit == 0:
|
||||||
|
return "Limit is zero, not backfilling"
|
||||||
with self.backfill_lock:
|
with self.backfill_lock:
|
||||||
output = await self.backfill(
|
output = await self.backfill(
|
||||||
source, source.client, forward=True, forward_limit=limit, last_tgid=last_tgid
|
source, source.client, forward=True, forward_limit=limit, last_tgid=last_tgid
|
||||||
|
|||||||
Reference in New Issue
Block a user