@@ -377,11 +377,6 @@ def collect(self) -> Iterable[Metric]:
377
377
"Tick time of the Twisted reactor (sec)" ,
378
378
buckets = [0.001 , 0.002 , 0.005 , 0.01 , 0.025 , 0.05 , 0.1 , 0.2 , 0.5 , 1 , 2 , 5 ],
379
379
)
380
- pending_calls_metric = Histogram (
381
- "python_twisted_reactor_pending_calls" ,
382
- "Pending calls" ,
383
- buckets = [1 , 2 , 5 , 10 , 25 , 50 , 100 , 250 , 500 , 1000 ],
384
- )
385
380
386
381
#
387
382
# Federation Metrics
@@ -501,21 +496,6 @@ def collect(self) -> Iterable[Metric]:
501
496
def runUntilCurrentTimer (reactor : ReactorBase , func : F ) -> F :
502
497
@functools .wraps (func )
503
498
def f (* args : Any , ** kwargs : Any ) -> Any :
504
- now = reactor .seconds ()
505
- num_pending = 0
506
-
507
- # _newTimedCalls is one long list of *all* pending calls. Below loop
508
- # is based off of impl of reactor.runUntilCurrent
509
- for delayed_call in reactor ._newTimedCalls :
510
- if delayed_call .time > now :
511
- break
512
-
513
- if delayed_call .delayed_time > 0 :
514
- continue
515
-
516
- num_pending += 1
517
-
518
- num_pending += len (reactor .threadCallQueue )
519
499
start = time .time ()
520
500
ret = func (* args , ** kwargs )
521
501
end = time .time ()
@@ -526,7 +506,6 @@ def f(*args: Any, **kwargs: Any) -> Any:
526
506
# I/O events, but that is harder to capture without rewriting half the
527
507
# reactor.
528
508
tick_time .observe (end - start )
529
- pending_calls_metric .observe (num_pending )
530
509
531
510
# Update the time we last ticked, for the metric to test whether
532
511
# Synapse's reactor has frozen
@@ -540,10 +519,7 @@ def f(*args: Any, **kwargs: Any) -> Any:
540
519
541
520
try :
542
521
# Ensure the reactor has all the attributes we expect
543
- reactor .seconds # type: ignore
544
522
reactor .runUntilCurrent # type: ignore
545
- reactor ._newTimedCalls # type: ignore
546
- reactor .threadCallQueue # type: ignore
547
523
548
524
# runUntilCurrent is called when we have pending calls. It is called once
549
525
# per iteratation after fd polling.
0 commit comments