Home / Function/ sleepWithContext() — fiber Function Reference

sleepWithContext() — fiber Function Reference

Architecture documentation for the sleepWithContext() function in timeout_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  427ca03d_9855_302a_6cda_36c7210f3310["sleepWithContext()"]
  bab1b67e_4e42_cfe9_38ec_3f1f6a839718["timeout_test.go"]
  427ca03d_9855_302a_6cda_36c7210f3310 -->|defined in| bab1b67e_4e42_cfe9_38ec_3f1f6a839718
  c6ad2652_bc30_fa0c_8d42_6869c7b119da["TestTimeout_Success()"]
  c6ad2652_bc30_fa0c_8d42_6869c7b119da -->|calls| 427ca03d_9855_302a_6cda_36c7210f3310
  f3f28fee_24ee_2aeb_c3f3_0097f4cf24c5["TestTimeout_Exceeded()"]
  f3f28fee_24ee_2aeb_c3f3_0097f4cf24c5 -->|calls| 427ca03d_9855_302a_6cda_36c7210f3310
  f43f2a47_ef5f_6c99_9791_7b778afeed70["TestTimeout_CustomError()"]
  f43f2a47_ef5f_6c99_9791_7b778afeed70 -->|calls| 427ca03d_9855_302a_6cda_36c7210f3310
  11a6e143_7809_b071_6867_b0007716385b["TestTimeout_CustomHandler()"]
  11a6e143_7809_b071_6867_b0007716385b -->|calls| 427ca03d_9855_302a_6cda_36c7210f3310
  style 427ca03d_9855_302a_6cda_36c7210f3310 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/timeout/timeout_test.go lines 29–39

func sleepWithContext(ctx context.Context, d time.Duration, te error) error {
	timer := time.NewTimer(d)
	defer timer.Stop() // Clean up the timer

	select {
	case <-ctx.Done():
		return te
	case <-timer.C:
		return nil
	}
}

Domain

Subdomains

Frequently Asked Questions

What does sleepWithContext() do?
sleepWithContext() is a function in the fiber codebase, defined in middleware/timeout/timeout_test.go.
Where is sleepWithContext() defined?
sleepWithContext() is defined in middleware/timeout/timeout_test.go at line 29.
What calls sleepWithContext()?
sleepWithContext() is called by 4 function(s): TestTimeout_CustomError, TestTimeout_CustomHandler, TestTimeout_Exceeded, TestTimeout_Success.

Analyze Your Own Codebase

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

Try Supermodel Free