// startPurgerLoop creates a go-routine which periodically performs a lock Purge, which removes expired locks
// if closerChannel is closed, this go-routine finishes its execution, releasing its WaitGroup delta.
startPurgerLoop creates a go-routine which periodically performs a lock Purge, which removes expired locks
if closerChannel is closed, this go-routine finishes its execution, releasing its WaitGroup delta.
// startPurgerLoop creates a go - routine which periodically performs a lock Purge which removes expired locks // if closerChannel is closed this go - routine finishes its execution releasing its WaitGroup delta .
func (l *Lock) startPurgerLoop(ctx context.Context) {
	l.WaitGroup.Add(1)
	go func() {
		defer l.WaitGroup.Done()
		for {
			l.Purger.Purge(ctx)
			select {
			case <-l.CloserChannel:
				log.Info(ctx, "closing mongo db lock purger go-routine")
				return
			case <-time.After(PurgerPeriod):
				log.Info(ctx, "purging expired mongoDB locks")
			}
		}
	}()
}
func ( l * Lock ) startPurgerLoop ( ctx context . Context ) { l . WaitGroup . Add ( 1 ) go func ( ) { defer l . WaitGroup . Done ( ) for { l . Purger . Purge ( ctx ) select { case <- l . CloserChannel : log . Info ( ctx , " " ) return case <- time . After ( PurgerPeriod ) : log . Info ( ctx , " " ) } } } ( ) }
startPurgerLoop creates a go-routine which periodically performs a lock Purge, which removes expired locks
if closerChannel is closed, this go-routine finishes its execution, releasing its WaitGroup delta.
startPurgerLoop creates a go - routine which periodically performs a lock Purge which removes expired locks if closerChannel is closed this go - routine finishes its execution releasing its WaitGroup delta .