This commit is contained in:
James Mills 2022-04-03 16:51:02 +10:00
rodič de4e7a1c4c
revize 1f484d20c7
V databázi nebyl nalezen žádný známý klíč pro tento podpis
ID GPG klíče: AC4C014F1440EBD6
2 změnil soubory, kde provedl 10 přidání a 6 odebrání

Zobrazit soubor

Zobrazit soubor

@ -334,7 +334,7 @@ func (mb *MessageBus) readLog(f fs.FileInfo) error {
return fmt.Errorf("error opening log %s: %w", f, err)
}
t := mb.NewTopic(filepath.Base(f.Name()))
t := mb.newTopic(filepath.Base(f.Name()))
t.Created = f.ModTime()
index, err := l.LastIndex()
@ -399,11 +399,7 @@ func (mb *MessageBus) Metrics() *Metrics {
return mb.metrics
}
// NewTopic ...
func (mb *MessageBus) NewTopic(topic string) *Topic {
mb.Lock()
defer mb.Unlock()
func (mb *MessageBus) newTopic(topic string) *Topic {
t, ok := mb.topics[topic]
if !ok {
t = &Topic{Name: topic, Created: time.Now()}
@ -415,6 +411,14 @@ func (mb *MessageBus) NewTopic(topic string) *Topic {
return t
}
// NewTopic ...
func (mb *MessageBus) NewTopic(topic string) *Topic {
mb.Lock()
defer mb.Unlock()
return mb.newTopic(topic)
}
// NewMessage ...
func (mb *MessageBus) NewMessage(topic *Topic, payload []byte) Message {
defer func() {