
Send an event to the event bus whenever the farm status changes. The event contains a farm status report (like `{status: "active"}`), and is sent to the `/status` topic. Note that at this moment the status is only polled every X seconds, and thus may lag behind other events.
18 lines
471 B
Go
18 lines
471 B
Go
package eventbus
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import (
|
|
"github.com/rs/zerolog/log"
|
|
"projects.blender.org/studio/flamenco/pkg/api"
|
|
)
|
|
|
|
func NewFarmStatusEvent(farmstatus api.FarmStatusReport) api.EventFarmStatus {
|
|
return api.EventFarmStatus(farmstatus)
|
|
}
|
|
|
|
func (b *Broker) BroadcastFarmStatusEvent(event api.EventFarmStatus) {
|
|
log.Debug().Interface("event", event).Msg("eventbus: broadcasting FarmStatus event")
|
|
b.broadcast(TopicFarmStatus, event)
|
|
}
|