aboutsummaryrefslogtreecommitdiff
path: root/appservice
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-06-12 15:11:33 +0100
committerGitHub <noreply@github.com>2020-06-12 15:11:33 +0100
commit0dc4ceaa2d8e46aa0134c1aabe96389ba4c1591d (patch)
tree01fc28ca7c7590e37f05923169602622b2144971 /appservice
parentecd7accbad724f26248498a9035a1fbc69e2f08d (diff)
Minor perf/debugging improvements (#1121)
* Minor perf/debugging improvements - publicroomsapi: Don't call QueryEventsByID with no event IDs - appservice: Consume only if there are 1 or more ASes - roomserver: don't keep a copy of the request "for debugging" - we trace now * fedsender: return early if we have no destinations * Unbreak tests
Diffstat (limited to 'appservice')
-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