- commit
- b2802e9d85dbcbed3c562b3d5fa15dc91ac8f79b
- parent
- ca8acff929cbfeb65d38833ba4b56cd748e12188
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-10-15 08:02
limit number of history entries
Diffstat
| M | via.go | 5 | +++++ |
1 files changed, 5 insertions, 0 deletions
diff --git a/via.go b/via.go
@@ -32,6 +32,7 @@ type Topic struct {
32 32 var mux = &sync.RWMutex{}
33 33 var topics = make(map[string]*Topic)
34 34 var verbose = false
-1 35 var maxHistorySize = 100
35 36 var dir = ""
36 37
37 38 func splitPassword(combined string) (string, string) {
@@ -135,6 +136,10 @@ func post(w http.ResponseWriter, r *http.Request) {
135 136
136 137 if topic.hasHistory {
137 138 topic.history = append(topic.history, msg)
-1 139
-1 140 for len(topic.history) > maxHistorySize {
-1 141 topic.history = topic.history[1:]
-1 142 }
138 143 }
139 144
140 145 for channel := range topic.channels {