mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-22 17:46:08 +03:00
Run as background process and fix comments
This commit is contained in:
parent
fc51e21326
commit
554609288b
3 changed files with 7 additions and 4 deletions
|
@ -93,7 +93,7 @@ class _EventInternalMetadata(object):
|
|||
return getattr(self, "soft_failed", False)
|
||||
|
||||
def should_proactively_send(self):
|
||||
"""Whether the eventm, if ours, should be sent to other clients and
|
||||
"""Whether the event, if ours, should be sent to other clients and
|
||||
servers.
|
||||
|
||||
This is used for sending dummy events internally. Servers and clients
|
||||
|
|
|
@ -34,6 +34,7 @@ from synapse.api.errors import (
|
|||
from synapse.api.room_versions import RoomVersions
|
||||
from synapse.api.urls import ConsentURIBuilder
|
||||
from synapse.events.validator import EventValidator
|
||||
from synapse.metrics.background_process_metrics import run_as_background_process
|
||||
from synapse.replication.http.send_event import ReplicationSendEventRestServlet
|
||||
from synapse.storage.state import StateFilter
|
||||
from synapse.types import RoomAlias, UserID, create_requester
|
||||
|
@ -265,9 +266,11 @@ class EventCreationHandler(object):
|
|||
not self.config.worker_app
|
||||
and self.config.cleanup_extremities_with_dummy_events
|
||||
):
|
||||
# XXX: Send dummy events.
|
||||
self.clock.looping_call(
|
||||
self._send_dummy_events_to_fill_extremities,
|
||||
lambda: run_as_background_process(
|
||||
"send_dummy_events_to_fill_extremities",
|
||||
self._send_dummy_events_to_fill_extremities
|
||||
),
|
||||
5 * 60 * 1000,
|
||||
)
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ class CleanupExtremDummyEventsTestCase(HomeserverTestCase):
|
|||
)
|
||||
self.assertEqual(len(latest_event_ids), 50)
|
||||
|
||||
# Bump the reacto repeatedly so that the background updates have a
|
||||
# Pump the reactor repeatedly so that the background updates have a
|
||||
# chance to run.
|
||||
self.pump(10 * 60)
|
||||
|
||||
|
|
Loading…
Reference in a new issue