summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.go18
-rw-r--r--docs/cca.scfg.example5
-rw-r--r--wsm.go15
3 files changed, 28 insertions, 10 deletions
diff --git a/config.go b/config.go
index 682bcd3..1bbba9a 100644
--- a/config.go
+++ b/config.go
@@ -65,10 +65,11 @@ var configWithPointers struct {
Expr *int `scfg:"expr"`
} `scfg:"auth"`
Perf struct {
- MessageArgumentsCap *int `scfg:"msg_args_cap"`
- MessageBytesCap *int `scfg:"msg_bytes_cap"`
- ReadHeaderTimeout *int `scfg:"read_header_timeout"`
- UsemDelayShiftBits *int `scfg:"usem_delay_shift_bits"`
+ MessageArgumentsCap *int `scfg:"msg_args_cap"`
+ MessageBytesCap *int `scfg:"msg_bytes_cap"`
+ ReadHeaderTimeout *int `scfg:"read_header_timeout"`
+ UsemDelayShiftBits *int `scfg:"usem_delay_shift_bits"`
+ PropagateImmediate *bool `scfg:"propagate_immediate"`
} `scfg:"perf"`
}
@@ -103,6 +104,7 @@ var config struct {
MessageBytesCap int
ReadHeaderTimeout int
UsemDelayShiftBits int
+ PropagateImmediate bool
} `scfg:"perf"`
}
@@ -293,5 +295,13 @@ func fetchConfig(path string) (retErr error) {
}
config.Perf.UsemDelayShiftBits = *(configWithPointers.Perf.UsemDelayShiftBits)
+ if configWithPointers.Perf.PropagateImmediate == nil {
+ return fmt.Errorf(
+ "%w: perf.propagate_immediate",
+ errMissingConfigValue,
+ )
+ }
+ config.Perf.PropagateImmediate = *(configWithPointers.Perf.PropagateImmediate)
+
return nil
}
diff --git a/docs/cca.scfg.example b/docs/cca.scfg.example
index 72eb718..b01fe40 100644
--- a/docs/cca.scfg.example
+++ b/docs/cca.scfg.example
@@ -90,4 +90,9 @@ perf {
# larger value (i.e. shorter delay) could cause too much lock
# contention and degrade the system usability overall.
usem_delay_shift_bits 4
+
+ # Should we send a course's member count to a user as soon as they
+ # choose the course? Setting this to true may provide a better
+ # user experience but would have a major performance impact.
+ propagate_immediate true
}
diff --git a/wsm.go b/wsm.go
index 3f9a703..797475c 100644
--- a/wsm.go
+++ b/wsm.go
@@ -200,12 +200,15 @@ func messageChooseCourse(
err,
)
}
- err = sendSelectedUpdate(ctx, c, courseID)
- if err != nil {
- return fmt.Errorf(
- "error notifying after increment: %w",
- err,
- )
+
+ if config.Perf.PropagateImmediate {
+ err = sendSelectedUpdate(ctx, c, courseID)
+ if err != nil {
+ return fmt.Errorf(
+ "error notifying after increment: %w",
+ err,
+ )
+ }
}
} else {
err := tx.Rollback(ctx)