Added more error + display skipped host on default run for more visibility. (#3123)

This commit is contained in:
Sandeep Singh
2023-01-02 19:00:10 +05:30
committed by GitHub
parent d1636c243d
commit e66821b49f

View File

@@ -100,11 +100,9 @@ func (c *Cache) Check(value string) bool {
existingCacheItemValue := existingCacheItem.(*cacheItem)
if existingCacheItemValue.errors.Load() >= int32(c.MaxHostError) {
if c.verbose {
existingCacheItemValue.Do(func() {
gologger.Verbose().Msgf("Skipping %s as previously unresponsive %d times", finalValue, existingCacheItemValue.errors.Load())
})
}
existingCacheItemValue.Do(func() {
gologger.Info().Msgf("Skipped %s from target list as found unresponsive %d times", finalValue, existingCacheItemValue.errors.Load())
})
return true
}
return false
@@ -128,7 +126,7 @@ func (c *Cache) MarkFailed(value string, err error) {
_ = c.failedTargets.Set(finalValue, existingCacheItemValue)
}
var reCheckError = regexp.MustCompile(`(no address found for host|Client\.Timeout exceeded while awaiting headers|could not resolve host|connection refused|context deadline exceeded)`)
var reCheckError = regexp.MustCompile(`(no address found for host|could not connect to any address|Client\.Timeout exceeded while awaiting headers|could not resolve host|connection refused|context deadline exceeded)`)
// checkError checks if an error represents a type that should be
// added to the host skipping table.