@@ -49,10 +49,10 @@ func NewRateLimitService(
4949 logger telemetry.Logger ,
5050 client * redis.Client ,
5151 dispatcher * EventDispatcher ,
52- ) * RateLimitService {
53- rateLimiter : = & RateLimitService {
52+ ) ( rateLimiter * RateLimitService ) {
53+ rateLimiter = & RateLimitService {
5454 tracer : tracer ,
55- logger : logger ,
55+ logger : logger . WithService ( fmt . Sprintf ( "%T" , rateLimiter )) ,
5656 client : client ,
5757 dispatcher : dispatcher ,
5858 counters : make (map [string ]* userCounter ),
@@ -109,19 +109,19 @@ func (service *RateLimitService) Increment(ctx context.Context, userID entities.
109109
110110// Close flushes remaining dirty counters and stops the background goroutine.
111111func (service * RateLimitService ) Close () {
112- service .logger .Info ("RateLimitService shutting down, flushing counters" )
112+ service .logger .Info ("rate limit service shutting down, flushing counters" )
113113 close (service .done )
114114 if service .client != nil {
115115 service .flush (context .Background ())
116116 }
117- service .logger .Info ("RateLimitService shutdown complete" )
117+ service .logger .Info ("rate limit service shutdown complete" )
118118}
119119
120120func (service * RateLimitService ) flushLoop () {
121121 ticker := time .NewTicker (rateLimitFlushInterval )
122122 defer ticker .Stop ()
123123
124- service .logger .Info (fmt .Sprintf ("RateLimitService flush loop started ( interval: %s) " , rateLimitFlushInterval ))
124+ service .logger .Info (fmt .Sprintf ("rate limit service flush loop started with interval [%s] " , rateLimitFlushInterval ))
125125
126126 for {
127127 select {
@@ -130,7 +130,7 @@ func (service *RateLimitService) flushLoop() {
130130 service .flush (context .Background ())
131131 }
132132 case <- service .done :
133- service .logger .Info ("RateLimitService flush loop stopped" )
133+ service .logger .Info ("rate limit service flush loop stopped" )
134134 return
135135 }
136136 }
0 commit comments