Class: ActiveRecordPostgresRecovery::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record_postgres_recovery/configuration.rb

Constant Summary collapse

BOOLEAN_FALSE_VALUES =
[false, nil, 'false', 'FALSE', '0', 0, 'no', 'NO', 'off', 'OFF'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/active_record_postgres_recovery/configuration.rb', line 10

def initialize
  self.enabled = true
  @reporter = nil
  self.roles = %i[writing reading]
  self.failover_clear_roles = %i[writing]
  self.retry_read_queries = true
  self.max_retries = 1
  @error_patterns = [
    /PQconsumeInput\(\).*terminating connection due to administrator command.*SSL connection has been closed unexpectedly/im,
    /PQsocket\(\) can't get socket descriptor/i,
    /read-only transaction/i
  ]
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



8
9
10
# File 'lib/active_record_postgres_recovery/configuration.rb', line 8

def enabled
  @enabled
end

#error_patternsObject

Returns the value of attribute error_patterns.



7
8
9
# File 'lib/active_record_postgres_recovery/configuration.rb', line 7

def error_patterns
  @error_patterns
end

#failover_clear_rolesObject

Returns the value of attribute failover_clear_roles.



8
9
10
# File 'lib/active_record_postgres_recovery/configuration.rb', line 8

def failover_clear_roles
  @failover_clear_roles
end

#max_retriesObject

Returns the value of attribute max_retries.



8
9
10
# File 'lib/active_record_postgres_recovery/configuration.rb', line 8

def max_retries
  @max_retries
end

#reporterObject

Returns the value of attribute reporter.



7
8
9
# File 'lib/active_record_postgres_recovery/configuration.rb', line 7

def reporter
  @reporter
end

#retry_read_queriesObject

Returns the value of attribute retry_read_queries.



8
9
10
# File 'lib/active_record_postgres_recovery/configuration.rb', line 8

def retry_read_queries
  @retry_read_queries
end

#rolesObject

Returns the value of attribute roles.



8
9
10
# File 'lib/active_record_postgres_recovery/configuration.rb', line 8

def roles
  @roles
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/active_record_postgres_recovery/configuration.rb', line 28

def enabled?
  enabled
end

#retry_read_queries?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/active_record_postgres_recovery/configuration.rb', line 36

def retry_read_queries?
  retry_read_queries
end