For bad historical reasons, the CI broker was using a synthetic
"shutdown" event to signal from one thread to another that the node
connection has been disconnected. At an earlier stage of development,
this the only way for the "read node events" thread to notify the
"process queued events" thread that there would never be any more
events.
Now we have inter-thread message channels and we can use their closing
to do the signaling.
However, this meant that the queue would have a spurious shutdown
event. This led to the following sequence of things happening:
* node shuts down
* CI broker notices this, adds a shutdown event to queue, then
terminates the event-reading thread, thereby closing the message
channel
* the queue processing notices the message channel is closed, and
terminates
* the CI broker process terminates
* systemd restarts the CI broker
* the CI broker finds a shutdown event in the queue and terminates
The shutdown event is still needed so that the node admin has a
convenient way to tell the CI broker to terminate, even if they don't
have the privilege to stop systemd units.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
To process old queued events, run older version of CI broker until
queue is empty ("cib queued"), then upgrade.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Add a new table for a queue of CI events. Drop most of the methods
that operate on the old queue of broker events, but leave a method to
check if its empty.
We can't use the existing table event_queue, as that contains
serialized broker events, which are entirely incompatible with CI
events.
Previously, needed to use a full path, because of a type name clash.
Now that the clash is gone, we can import and use the name directly.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
After various previous changes, the PageBuilder::build now only calls
StatusPage::new, so there's no point in the type. Drop it.
Also replace StatusPage::new with StatusPage::default, for better
style.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Co-worker reported that the unwrap of the optional adapter run id
triggered a panic for them.
Each run has a unique broker run id, and an optional, non-unique
adapter run id. Use the broker run id instead.
Actually, the whole PageBuilder type is now useless, but I'll tackle
that separately.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Change the dummy adapter to read the trigger message from its stdin.
This prevents a race condition where the adapter exits before the CI
broker has time to write the trigger message to the adapter.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
To get this to work, I had to remove Cargo.lock and let it be
re-created:
rm Cargo.lock && cargo add radicle@0.13.0 radicle-git-ext@0.8.0 radicle-surf@0.22.0
Signed-off-by: Lars Wirzenius <liw@liw.fi>