Sync branch magefile with main #104308

Merged
Sybren A. Stüvel merged 85 commits from abelli/flamenco:magefile into magefile 2024-05-13 16:26:32 +02:00
2 changed files with 13 additions and 1 deletions
Showing only changes of commit 9bfb53a7f6 - Show all commits

View File

@ -14,6 +14,7 @@ import (
"github.com/rs/zerolog/log"
"projects.blender.org/studio/flamenco/internal/uuid"
"projects.blender.org/studio/flamenco/pkg/api"
"projects.blender.org/studio/flamenco/pkg/website"
)
type SocketIOEventType string
@ -59,7 +60,17 @@ func (s *SocketIOForwarder) Broadcast(topic EventTopic, payload interface{}) {
// SocketIO has a concept of 'event types'. MQTT doesn't have this, and thus the Flamenco event
// system doesn't rely on it. We use the payload type name as event type.
payloadType := reflect.TypeOf(payload).Name()
eventType := socketIOEventTypes[payloadType]
eventType, ok := socketIOEventTypes[payloadType]
if !ok {
log.Error().
Str("topic", string(topic)).
Str("payloadType", payloadType).
Interface("event", payload).
Msgf("socketIO: payload type does not have an event type, please copy-paste this message into a bug report at %s", website.BugReportURL)
return
}
log.Debug().
Str("topic", string(topic)).
Str("eventType", eventType).

View File

@ -6,6 +6,7 @@ import "fmt"
const (
// Topics on which events are published.
// NOTE: when adding here, also add to socketIOEventTypes in socketio.go.
TopicLifeCycle EventTopic = "/lifecycle" // sends api.EventLifeCycle
TopicFarmStatus EventTopic = "/status" // sends api.EventFarmStatus
TopicJobUpdate EventTopic = "/jobs" // sends api.EventJobUpdate