Skip to content

Commit

Permalink
feat: refactored for cloud logs service (#4973)
Browse files Browse the repository at this point in the history
* feat: refactored for cloud logs service

* fix: commment

* fix: renamed mapper

* fix: panic when trying to stop second time
  • Loading branch information
exu authored Feb 6, 2024
1 parent 1bc0381 commit 0a286e2
Show file tree
Hide file tree
Showing 6 changed files with 347 additions and 81 deletions.
2 changes: 0 additions & 2 deletions pkg/logs/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ func (ls *LogsService) stopConsumer(ctx context.Context, wg *sync.WaitGroup, con
err := adapter.Stop(id)
if err != nil {
l.Errorw("stop error", "adapter", adapter.Name(), "error", err)
continue
}

return
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/logs/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestLogs_EventsFlow(t *testing.T) {
assert.NoError(t, err)

// cooldown stop time
time.Sleep(waitTime * 2)
time.Sleep(waitTime)

// then all adapters should be gracefully stopped
assert.Equal(t, 0, log.GetConsumersStats(ctx).Count)
Expand Down Expand Up @@ -316,7 +316,7 @@ func TestLogs_EventsFlow(t *testing.T) {
assert.Equal(t, "stop-queued", string(r.Message))

// there will be wait for mess
time.Sleep(waitTime * 2)
time.Sleep(waitTime)

// then all adapters should be gracefully stopped
assert.Equal(t, 0, log.GetConsumersStats(ctx).Count)
Expand Down
238 changes: 185 additions & 53 deletions pkg/logs/pb/logs.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0a286e2

Please sign in to comment.