debug
This commit is contained in:
parent
9d2fc298c2
commit
3096e0e921
@ -110,6 +110,7 @@ func (r *GigaChatClient) TokenResearch(ctx context.Context) {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
ttl, err := r.redisClient.TTL(ctx, "gigachat_token").Result()
|
||||
fmt.Println("GGCHATtoken", ttl, err, ttl<2*time.Minute)
|
||||
if err != nil || ttl < 2*time.Minute {
|
||||
if err := r.updateToken(ctx); err != nil {
|
||||
r.logger.Error("failed to update GigaChat token", zap.Error(err))
|
||||
@ -147,6 +148,7 @@ func (r *GigaChatClient) updateToken(ctx context.Context) error {
|
||||
}
|
||||
|
||||
ttl := time.Until(time.Unix(respData.ExpiresAt, 0))
|
||||
fmt.Println("GGCTOKENEXP", respData.ExpiresAt, ttl, ttl<2*time.Minute, time.Now())
|
||||
err = r.redisClient.Set(ctx, "gigachat_token", respData.AccessToken, ttl).Err()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to save token to redis: %w", err)
|
||||
|
Loading…
Reference in New Issue
Block a user