Commit Graph

16 Commits

Author SHA1 Message Date
Tony Garnock-Jones ac4f15325f The Big Spawn/Actor Swap 2017-02-20 17:32:22 -05:00
Tony Garnock-Jones 1951a285c8 `web-request-header-websocket-upgrade?` 2016-11-26 11:25:59 +13:00
Tony Garnock-Jones 1eeb2ce59a syndicate/drivers/config 2016-11-23 13:49:46 +13:00
Tony Garnock-Jones 2a9273142a Split out relay subscriptions from remote topics.
The previous code was trying to do too much with local dataflow. This
refactoring splits (stateful) relay upstream subscriptions out into
actors of their own.

Previously, dataflow variables were used to hold a single upstream hub
and a single upstream canonical topic URL. This causes problems when
things change rapidly: an unsubscription or subscription might be in
flight, and there was no way to tell what the resulting state of the
remote topic as a whole should be if the fields had changed between
the start and finish of an in flight action.

The new design follows from the observation that an individual
subscription to an upstream hub is a stateful entity: it deserves
promotion to a full actor. There is now an actor for the remote topic,
and one for each established upstream subscription. Upstream
subscriptions are created in response to demand expressed by the
remote topic actor; to switch, all it needs to do is update its
demand, and new subscriptions will spring into being while surplus
subscriptions gracefully terminate.

Also, this commit fixes a bug where upstream subscriptions were being
made to the requested-topic rather than to the upstream-topic.
Consequently, self-subscriptions (with multiple `http-listener`
aliases) work now without infinite mail loops.

There is still an issue that blocking actions in on-stop clauses don't
run to completion; that is being dealt with separately, as part of a
reexamination of facet-terminating events more generally.
2016-11-22 15:16:35 +13:00
Tony Garnock-Jones d2c161fd3e Remove layer of actor*, to avoid out-of-context field access; switch from 201 to 202 for posts 2016-11-22 13:32:32 +13:00
Tony Garnock-Jones 709042bb46 Convert the issued lease-seconds from string 2016-11-22 11:51:10 +13:00
Tony Garnock-Jones f14e0acfcb Reinterpret canonical-local-host -> canonical-baseurl.
In order to support HTTPS nginx proxying, we need to maintain a
"fictional" baseurl which is not directly connected to this server's
listen ports. This has caused a change to configuration: now, a
baseurl is specified along with one or more listen specifications.
2016-11-22 11:35:39 +13:00
Tony Garnock-Jones eef6c8c4b7 More logging for remote topics 2016-11-22 10:09:07 +13:00
Tony Garnock-Jones 51088343c4 Fixes and improvements toward proper upstream subscriptions 2016-11-22 10:04:07 +13:00
Tony Garnock-Jones 79e8d87e5f Terminate a websocket subscription when the websocket closes 2016-11-21 17:46:56 +13:00
Tony Garnock-Jones 01d8ba9456 Unsubscribe when interest in a remote topic goes away 2016-11-21 17:46:45 +13:00
Tony Garnock-Jones 2fa3f13c9b More logging 2016-11-21 17:46:32 +13:00
Tony Garnock-Jones a2c63ca007 Websocket subscription 2016-11-21 17:05:33 +13:00
Tony Garnock-Jones 27d57b2c52 Only poll upstream when some polling is desired 2016-11-21 17:05:17 +13:00
Tony Garnock-Jones f6cb3282bd Minor refactoring 2016-11-21 17:05:01 +13:00
Tony Garnock-Jones 9f6a73a8b0 Split server.rkt into hub.rkt and hub/*.rkt 2016-11-21 10:13:40 +13:00