Skip to content

Chapter 8: Hexarch Filelogger - Negative WaitGroup Counter #4

@mshearer0

Description

@mshearer0

Hexarch example fails with panic: sync: negative WaitGroup counter.

Removing extra wg.Done from Write methods of FileTransactionLogger solves the issue:

func (l *FileTransactionLogger) WritePut(key, value string) {
l.wg.Add(1)
l.events <- core.Event{EventType: core.EventPut, Key: key, Value: url.QueryEscape(value)}
// l.wg.Done()
}

func (l *FileTransactionLogger) WriteDelete(key string) {
l.wg.Add(1)
l.events <- core.Event{EventType: core.EventDelete, Key: key}
// l.wg.Done()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions