Skip to content

Commit

Permalink
log exit messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Feb 8, 2024
1 parent d05e666 commit f262706
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lsm/lsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ func (lsm *Tree[T]) Start(ctx context.Context) {
lsm.log.Info("Start compaction loop", "interval", interval.String(),
"compactSize", units.BytesSize(float64(lsm.opts.compactSize)))
tick := time.NewTicker(interval)
defer tick.Stop()
defer func() {
tick.Stop()
lsm.log.Info("exiting compaction loop")
}()

for {
select {
case <-ctx.Done():
Expand Down
9 changes: 8 additions & 1 deletion session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ func (s *Session) Queue(ctx context.Context, req *v1.Event) {

func (s *Session) doProcess(ctx context.Context) {
s.log.Info("Starting events processing loop")
defer func() {
s.log.Info("Exiting events processing loop")
}()
for {
select {
case <-ctx.Done():
Expand Down Expand Up @@ -128,8 +131,12 @@ func (s *Session) Start(ctx context.Context) {

func (s *Session) doFlush(ctx context.Context) {
s.log.Info("Starting session flushing loop", "interval", DefaultFlushInterval.String())

tk := time.NewTicker(DefaultFlushInterval)
defer tk.Stop()
defer func() {
tk.Stop()
s.log.Info("Exiting flushing loop")
}()

for {
select {
Expand Down

0 comments on commit f262706

Please sign in to comment.