Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HandleSetSceneEvent scenedef.SetSceneEventHandler = func(body *scenedef.SetSceneEvent) firehose.Result { metadata := map[string]string{ "scene_id": strconv.Itoa(int(body.SceneId)), } scene := &domain.Scene{} if err := database.Find(&scene, body.SceneId); err != nil { return firehose.Discard(oops.WithMetadata(err, metadata)) } if scene == nil { err := oops.NotFound("scene not found", metadata) return firehose.Discard(err) } lock, err := distsync.Lock(nil, "scene", body.SceneId) if err != nil { return firehose.Fail(oops.WithMetadata(err, metadata)) } defer lock.Unlock() slog.Infof("Setting scene %d...", body.SceneId) stages := constructStages(scene) for _, stage := range stages { var g errgroup.Group for _, action := range stage { g.Go(func() error { return action.Perform(context.TODO()) }) } if err := g.Wait(); err != nil { return firehose.Fail(err) } } return firehose.Success() }
HandleSetSceneEvent sets the scene
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.