add comment

This commit is contained in:
Sam Lewis
2022-11-10 20:27:34 -05:00
parent 0f970c2732
commit f6c68fe8ca

3
app.go
View File

@@ -192,11 +192,14 @@ func (a *App) Start() {
// entity listeners runOnStartup
for eid, etls := range a.entityListeners {
for _, etl := range etls {
// ensure each ETL only runs once, even if
// it listens to multiple entities
if etl.runOnStartup && !etl.runOnStartupCompleted {
entityState, err := a.state.Get(eid)
if err != nil {
log.Default().Println("Failed to get entity state \"", eid, "\" during startup, skipping RunOnStartup")
}
etl.runOnStartupCompleted = true
go etl.callback(a.service, a.state, EntityData{
TriggerEntityId: eid,