mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
pull-hook: restart subscriptions in on-load
This commit is contained in:
parent
b11b343280
commit
1ed07f3295
@ -162,33 +162,44 @@
|
|||||||
=| cards=(list card:agent:gall)
|
=| cards=(list card:agent:gall)
|
||||||
|^
|
|^
|
||||||
?- -.old
|
?- -.old
|
||||||
|
%0 $(-.old %1)
|
||||||
|
::
|
||||||
%1
|
%1
|
||||||
=^ og-cards pull-hook
|
=^ og-cards pull-hook
|
||||||
(on-load:og inner-state.old)
|
(on-load:og inner-state.old)
|
||||||
[(weld cards og-cards) this(state old)]
|
=. state old
|
||||||
::
|
=/ restart-cards
|
||||||
%0
|
(restart-subscriptions tracking.old)
|
||||||
%_ $
|
:_ this
|
||||||
-.old %1
|
:(weld restart-cards cards og-cards)
|
||||||
::
|
|
||||||
cards
|
|
||||||
(weld cards (missing-subscriptions tracking.old))
|
|
||||||
==
|
|
||||||
==
|
==
|
||||||
++ missing-subscriptions
|
::
|
||||||
|= tracking=(map resource ship)
|
++ check-subscription
|
||||||
|
|= [rid=resource =ship]
|
||||||
|
^- ?
|
||||||
|
%+ lien
|
||||||
|
~(tap in ~(key by wex.bowl))
|
||||||
|
|= [=wire her=^ship app=term]
|
||||||
|
^- ?
|
||||||
|
?& =(app push-hook-name.config)
|
||||||
|
=(ship her)
|
||||||
|
=((scag 4 wire) /helper/pull-hook/pull/resource)
|
||||||
|
=(`rid (de-path-soft:resource (slag 4 wire)))
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ restart-subscriptions
|
||||||
|
|= pulling=(map resource ship)
|
||||||
^- (list card:agent:gall)
|
^- (list card:agent:gall)
|
||||||
%+ murn
|
%+ murn
|
||||||
~(tap by tracking)
|
~(tap by pulling)
|
||||||
|= [rid=resource =ship]
|
|= [rid=resource =ship]
|
||||||
^- (unit card:agent:gall)
|
^- (unit card:agent:gall)
|
||||||
=/ =path
|
?: (check-subscription rid ship) ~
|
||||||
resource+(en-path:resource rid)
|
~& >> "restarting: {<rid>}"
|
||||||
=/ =wire
|
=/ pax=(unit path)
|
||||||
(make-wire pull+path)
|
(on-pull-kick:og rid)
|
||||||
?: (~(has by wex.bowl) [wire ship push-hook-name.config])
|
?~ pax ~
|
||||||
~
|
`(watch-resource:hc rid u.pax)
|
||||||
`[%pass wire %agent [ship push-hook-name.config] %watch path]
|
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ on-save
|
++ on-save
|
||||||
@ -196,6 +207,7 @@
|
|||||||
=. inner-state
|
=. inner-state
|
||||||
on-save:og
|
on-save:og
|
||||||
!>(state)
|
!>(state)
|
||||||
|
::
|
||||||
++ on-poke
|
++ on-poke
|
||||||
|= [=mark =vase]
|
|= [=mark =vase]
|
||||||
^- [(list card:agent:gall) agent:gall]
|
^- [(list card:agent:gall) agent:gall]
|
||||||
@ -310,18 +322,23 @@
|
|||||||
::
|
::
|
||||||
++ remove
|
++ remove
|
||||||
|= =resource
|
|= =resource
|
||||||
:- ~[(leave-resource resource)]
|
:- (leave-resource resource)
|
||||||
state(tracking (~(del by tracking) resource))
|
state(tracking (~(del by tracking) resource))
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ leave-resource
|
++ leave-resource
|
||||||
|= rid=resource
|
|= rid=resource
|
||||||
^- card
|
^- (list card)
|
||||||
=/ =ship
|
%+ roll
|
||||||
(~(got by tracking) rid)
|
~(tap in ~(key by wex.bowl))
|
||||||
=/ =wire
|
|= [[=wire her=ship app=term] out=(list card)]
|
||||||
(make-wire pull+resource+(en-path:resource rid))
|
?. =(`rid (de-path-soft:resource (slag 4 wire)))
|
||||||
[%pass wire %agent [ship push-hook-name.config] %leave ~]
|
out
|
||||||
|
=/ him=(unit ship)
|
||||||
|
(~(get by tracking) rid)
|
||||||
|
?. =(`her him) out
|
||||||
|
:_ out
|
||||||
|
[%pass wire %agent [her push-hook-name.config] %leave ~]
|
||||||
|
|
||||||
++ watch-resource
|
++ watch-resource
|
||||||
|= [rid=resource pax=path]
|
|= [rid=resource pax=path]
|
||||||
|
Loading…
Reference in New Issue
Block a user