aboutsummaryrefslogtreecommitdiff
path: root/appservice/appservice.go
diff options
context:
space:
mode:
Diffstat (limited to 'appservice/appservice.go')
-rw-r--r--appservice/appservice.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/appservice/appservice.go b/appservice/appservice.go
index 0fbe3f20..bd261ff9 100644
--- a/appservice/appservice.go
+++ b/appservice/appservice.go
@@ -86,12 +86,16 @@ func NewInternalAPI(
Cfg: base.Cfg,
}
- consumer := consumers.NewOutputRoomEventConsumer(
- base.Cfg, base.KafkaConsumer, accountsDB, appserviceDB,
- rsAPI, workerStates,
- )
- if err := consumer.Start(); err != nil {
- logrus.WithError(err).Panicf("failed to start appservice roomserver consumer")
+ // Only consume if we actually have ASes to track, else we'll just chew cycles needlessly.
+ // We can't add ASes at runtime so this is safe to do.
+ if len(workerStates) > 0 {
+ consumer := consumers.NewOutputRoomEventConsumer(
+ base.Cfg, base.KafkaConsumer, accountsDB, appserviceDB,
+ rsAPI, workerStates,
+ )
+ if err := consumer.Start(); err != nil {
+ logrus.WithError(err).Panicf("failed to start appservice roomserver consumer")
+ }
}
// Create application service transaction workers