weldr/store: keep the compose status up-to-date

This way it can be correctly exposed in the API. We listen on a channel
from the job-queue, where status updates are pushed when the worker is
running/finished (or, in the future, failed).

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-09-27 14:34:51 +02:00
parent cad89c6650
commit f880581a14
7 changed files with 36 additions and 21 deletions

View file

@ -79,8 +79,9 @@ func main() {
stateChannel := make(chan []byte, 10)
jobChannel := make(chan job.Job, 200)
jobAPI := jobqueue.New(logger, jobChannel)
weldrAPI := weldr.New(repo, packages, logger, state, stateChannel, jobChannel)
jobUpdateChannel := make(chan job.Status, 200)
jobAPI := jobqueue.New(logger, jobChannel, jobUpdateChannel)
weldrAPI := weldr.New(repo, packages, logger, state, stateChannel, jobChannel, jobUpdateChannel)
go func() {
for {
err := writeFileAtomically(StateFile, <-stateChannel, 0755)