Class: Scheduler::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



15
16
17
18
19
20
21
# File 'lib/scheduler/configuration.rb', line 15

def initialize
  @logger = Rails.logger
  @job_class = ExampleSchedulableModel
  @polling_interval = 5
  @max_concurrent_jobs = [ Etc.nprocessors, 24 ].min
  @perform_jobs_in_test_or_development = false
end

Instance Attribute Details

#job_classClass

Returns the class of the main job model.

Returns:

  • (Class)

    the class of the main job model.



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

def job_class
  @job_class
end

#loggerString

Returns a logger file.

Returns:

  • (String)

    a logger file.



5
6
7
# File 'lib/scheduler/configuration.rb', line 5

def logger
  @logger
end

#max_concurrent_jobsInteger

Returns maximum number of concurent jobs.

Returns:

  • (Integer)

    maximum number of concurent jobs.



11
12
13
# File 'lib/scheduler/configuration.rb', line 11

def max_concurrent_jobs
  @max_concurrent_jobs
end

#perform_jobs_in_test_or_developmentBoolean

Returns whether to perform jobs when in test or development env.

Returns:

  • (Boolean)

    whether to perform jobs when in test or development env.



13
14
15
# File 'lib/scheduler/configuration.rb', line 13

def perform_jobs_in_test_or_development
  @perform_jobs_in_test_or_development
end

#polling_intervalInteger

Returns how much time to wait before each iteration.

Returns:

  • (Integer)

    how much time to wait before each iteration.



9
10
11
# File 'lib/scheduler/configuration.rb', line 9

def polling_interval
  @polling_interval
end