Home / Function/ Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt() — fiber Function Reference

Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt() — fiber Function Reference

Architecture documentation for the Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt() function in exponential_backoff_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  986119cc_b4bf_b7a5_3cf1_b63d94d19602["Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt()"]
  06704709_6b3e_c36a_84b3_c50264ae004e["exponential_backoff_test.go"]
  986119cc_b4bf_b7a5_3cf1_b63d94d19602 -->|defined in| 06704709_6b3e_c36a_84b3_c50264ae004e
  style 986119cc_b4bf_b7a5_3cf1_b63d94d19602 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

addon/retry/exponential_backoff_test.go lines 63–86

func Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt(t *testing.T) {
	t.Parallel()

	const (
		largeInterval = 5 * time.Second // would be used for sleep if bug existed
		maxAcceptable = 2 * time.Second // Retry must return well before largeInterval
	)

	eb := &ExponentialBackoff{
		InitialInterval: largeInterval,
		MaxBackoffTime:  largeInterval * 2,
		Multiplier:      2.0,
		MaxRetryCount:   1,
	}

	start := time.Now()
	err := eb.Retry(func() error { return errors.New("only attempt") })
	elapsed := time.Since(start)

	require.Error(t, err)
	require.Equal(t, "only attempt", err.Error())
	require.Less(t, elapsed, maxAcceptable,
		"Retry must not sleep after the last failed attempt; took %v (expected < %v)", elapsed, maxAcceptable)
}

Domain

Subdomains

Frequently Asked Questions

What does Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt() do?
Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt() is a function in the fiber codebase, defined in addon/retry/exponential_backoff_test.go.
Where is Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt() defined?
Test_ExponentialBackoff_Retry_NoSleepAfterLastAttempt() is defined in addon/retry/exponential_backoff_test.go at line 63.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free