Class: Makit::Configuration::Timeout
- Inherits:
-
Object
- Object
- Makit::Configuration::Timeout
- Defined in:
- lib/makit/configuration/timeout.rb
Overview
Configuration for timeouts across the makit system
Constant Summary collapse
- DEFAULTS =
Default timeout values for different operations
{ # Command execution timeouts command: 300, git_clone: 300, git_pull: 120, bundle_install: 300, dotnet_build: 300, dotnet_publish: 300, dotnet_test: 180, dotnet_restore: 120, protoc_generate: 60, gem_build: 300, gem_install: 120, # Strategy timeouts childprocess: 30, open3: 30, # Example execution timeout example: 30, }.freeze
Class Method Summary collapse
-
.all_timeouts ⇒ Hash
Get all configured timeouts.
-
.default_for(operation) ⇒ Integer
Get the default timeout for a specific operation.
-
.global_default ⇒ Integer
Get the global default timeout from environment or fallback.
-
.set_timeout(operation, timeout) ⇒ void
Set a custom timeout for an operation.
-
.validate_timeout(timeout) ⇒ Object
Validate a timeout value.
Class Method Details
.all_timeouts ⇒ Hash
Get all configured timeouts
57 58 59 |
# File 'lib/makit/configuration/timeout.rb', line 57 def self.all_timeouts DEFAULTS.dup end |
.default_for(operation) ⇒ Integer
Get the default timeout for a specific operation
34 35 36 |
# File 'lib/makit/configuration/timeout.rb', line 34 def self.default_for(operation) DEFAULTS[operation] || DEFAULTS[:command] end |
.global_default ⇒ Integer
Get the global default timeout from environment or fallback
41 42 43 |
# File 'lib/makit/configuration/timeout.rb', line 41 def self.global_default ENV["MAKIT_DEFAULT_TIMEOUT"]&.to_i || DEFAULTS[:command] end |
.set_timeout(operation, timeout) ⇒ void
This method returns an undefined value.
Set a custom timeout for an operation
50 51 52 |
# File 'lib/makit/configuration/timeout.rb', line 50 def self.set_timeout(operation, timeout) DEFAULTS[operation] = timeout end |
.validate_timeout(timeout) ⇒ Object
Validate a timeout value
65 66 67 68 69 70 71 |
# File 'lib/makit/configuration/timeout.rb', line 65 def self.validate_timeout(timeout) raise ArgumentError, "Timeout must be a positive integer" unless timeout.is_a?(Integer) && timeout.positive? return unless timeout > 3600 # 1 hour max raise ArgumentError, "Timeout cannot exceed 3600 seconds (1 hour)" end |