mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-18 20:31:40 +03:00
Merge pull request #5827 from urbit/ted/ames-clog-less
ames: %clog less
This commit is contained in:
commit
ad190807c7
@ -2571,27 +2571,40 @@
|
||||
?: =(0 (end 0 bone))
|
||||
~
|
||||
`u=message-pump-state
|
||||
:: clogged: are five or more response messages unsent to this peer?
|
||||
::
|
||||
=/ clogged=?
|
||||
=| acc=@ud
|
||||
|- ^- ?
|
||||
?~ pumps
|
||||
%.n
|
||||
=. acc
|
||||
%+ add acc
|
||||
%+ add
|
||||
:: in-flight messages
|
||||
::
|
||||
(sub [next current]:i.pumps)
|
||||
:: queued messages
|
||||
::
|
||||
~(wyt in unsent-messages.i.pumps)
|
||||
|^ &(nuf-messages nuf-memory)
|
||||
:: +nuf-messages: are there enough messages to mark as clogged?
|
||||
::
|
||||
?: (gte acc 5)
|
||||
%.y
|
||||
$(pumps t.pumps)
|
||||
:: if clogged, notify client vanek
|
||||
++ nuf-messages
|
||||
=| num=@ud
|
||||
|- ^- ?
|
||||
?~ pumps |
|
||||
=. num
|
||||
;: add num
|
||||
(sub [next current]:i.pumps)
|
||||
~(wyt in unsent-messages.i.pumps)
|
||||
==
|
||||
?: (gte num 5)
|
||||
&
|
||||
$(pumps t.pumps)
|
||||
:: +nuf-memory: is enough memory used to mark as clogged?
|
||||
::
|
||||
++ nuf-memory
|
||||
=| mem=@ud
|
||||
|- ^- ?
|
||||
?~ pumps |
|
||||
=. mem
|
||||
%+ add
|
||||
%- ~(rep in unsent-messages.i.pumps)
|
||||
|=([a=@ b=_mem] (add b (met 3 a)))
|
||||
?~ unsent-fragments.i.pumps 0
|
||||
(met 3 fragment.i.unsent-fragments.i.pumps)
|
||||
?: (gte mem 100.000)
|
||||
&
|
||||
$(pumps t.pumps)
|
||||
--
|
||||
:: if clogged, notify client vane
|
||||
::
|
||||
?. clogged
|
||||
peer-core
|
||||
|
Loading…
Reference in New Issue
Block a user