@@ -250,29 +250,38 @@ func (hk *Housekeeper) UpdateProposerDutiesWithoutChecks(headSlot uint64) {
250250
251251// updateValidatorRegistrationsInRedis saves all latest validator registrations from the database to Redis
252252func (hk * Housekeeper ) updateValidatorRegistrationsInRedis () {
253- regs , err := hk .db .GetLatestValidatorRegistrations (true )
253+ log := hk .log
254+ log .Infof ("updateValidatorRegistrationsInRedis: getting registrations from DB..." )
255+
256+ timeStarted := time .Now ()
257+ regs , err := hk .db .GetLatestValidatorRegistrations (false )
254258 if err != nil {
255- hk . log .WithError (err ).Error ("failed to get latest validator registrations" )
259+ log .WithError (err ).Error ("failed to get latest validator registrations" )
256260 return
257261 }
258262
259- hk .log .Infof ("updating %d validator registrations in Redis..." , len (regs ))
260- timeStarted := time .Now ()
263+ log = log .WithFields (logrus.Fields {
264+ "numRegistrations" : len (regs ),
265+ "timeNeededDBSec" : time .Since (timeStarted ).Seconds (),
266+ })
267+ log .Info ("updateValidatorRegistrationsInRedis: got registrations from DB, updating Redis (this may take a while)..." )
261268
269+ timeStarted = time .Now ()
262270 for _ , reg := range regs {
263271 // convert DB data to original struct
264272 data , err := reg .ToSignedValidatorRegistration ()
265273 if err != nil {
266- hk . log .WithError (err ).Error ("failed to convert validator registration entry to signed validator registration" )
274+ log .WithError (err ).Error ("failed to convert validator registration entry to signed validator registration" )
267275 continue
268276 }
269277
270278 // save to Redis
271279 err = hk .redis .SetValidatorRegistrationData (data .Message )
272280 if err != nil {
273- hk . log .WithError (err ).Error ("failed to set validator registration" )
281+ log .WithError (err ).Error ("failed to set validator registration" )
274282 continue
275283 }
276284 }
277- hk .log .Infof ("updating %d validator registrations in Redis done - %f sec" , len (regs ), time .Since (timeStarted ).Seconds ())
285+
286+ log .WithField ("timeNeededRedisSec" , time .Since (timeStarted ).Seconds ()).Info ("updateValidatorRegistrationsInRedis: updating Redis done" )
278287}
0 commit comments