diff options
-rw-r--r-- | config.go | 18 | ||||
-rw-r--r-- | docs/cca.scfg.example | 5 | ||||
-rw-r--r-- | wsm.go | 15 |
3 files changed, 28 insertions, 10 deletions
@@ -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 } @@ -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) |