(jobId string)
| 379 | } |
| 380 | |
| 381 | func shouldAttemptAutoReconnect(jobId string) bool { |
| 382 | now := time.Now().Unix() |
| 383 | lastAttempt, exists := lastAutoReconnectAttempt.GetEx(jobId) |
| 384 | |
| 385 | if !exists { |
| 386 | lastAutoReconnectAttempt.Set(jobId, now) |
| 387 | return true |
| 388 | } |
| 389 | |
| 390 | timeSinceLastAttempt := time.Duration(now-lastAttempt) * time.Second |
| 391 | if timeSinceLastAttempt >= AutoReconnectCooldown { |
| 392 | lastAutoReconnectAttempt.Set(jobId, now) |
| 393 | return true |
| 394 | } |
| 395 | |
| 396 | return false |
| 397 | } |
| 398 | |
| 399 | func attemptAutoReconnect(jobId string, connName string) { |
| 400 | defer func() { |
no test coverage detected