Skip to content

Commit

Permalink
Make write async
Browse files Browse the repository at this point in the history
  • Loading branch information
dongxuny committed Jan 30, 2022
1 parent 86ee807 commit 5c841b5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions syncer_loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,11 @@ type lokiStreamList struct {

// Write to logChannel
func (syncer *LokiSyncer) Write(p []byte) (n int, err error) {
syncer.logChannel <- &lokiValue{
Values: []string{fmt.Sprintf("%d", time.Now().UnixNano()), string(p)},
}

go func() {
syncer.logChannel <- &lokiValue{
Values: []string{fmt.Sprintf("%d", time.Now().UnixNano()), string(p)},
}
}()
return len(p), nil
}

Expand Down

0 comments on commit 5c841b5

Please sign in to comment.