Module: SolidCable

Defined in:
lib/solid_cable.rb,
lib/solid_cable/engine.rb,
lib/solid_cable/railtie.rb,
lib/solid_cable/version.rb,
app/jobs/solid_cable/trim_job.rb,
app/models/solid_cable/record.rb,
app/models/solid_cable/message.rb

Defined Under Namespace

Classes: Engine, InstallGenerator, Message, Railtie, Record, TrimJob, UpdateGenerator

Constant Summary collapse

VERSION =
"3.0.5"

Class Method Summary collapse

Class Method Details

.autotrim?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/solid_cable.rb', line 25

def autotrim?
  cable_config.autotrim != false
end

.connects_toObject



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

def connects_to
  cable_config.connects_to.to_h.deep_transform_values(&:to_sym)
end

.message_retentionObject



21
22
23
# File 'lib/solid_cable.rb', line 21

def message_retention
  parse_duration(cable_config.message_retention, default: 1.day)
end

.polling_intervalObject



17
18
19
# File 'lib/solid_cable.rb', line 17

def polling_interval
  parse_duration(cable_config.polling_interval, default: 0.1.seconds)
end

.silence_polling?Boolean

Returns:

  • (Boolean)


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

def silence_polling?
  cable_config.silence_polling != false
end

.trim_batch_sizeObject



29
30
31
32
33
34
35
# File 'lib/solid_cable.rb', line 29

def trim_batch_size
  if (size = cable_config.trim_batch_size.to_i) < 2
    100
  else
    size
  end
end

.trim_chanceObject

For every write that we do, we attempt to delete trim_chance times as many records. This ensures there is downward pressure on the cache size while there is valid data to delete. Read this as ‘every time the trim job runs theres a trim_multiplier chance this trims’. Adjust number to make it more or less likely to trim. Only works like this if trim_batch_size is 100



47
48
49
# File 'lib/solid_cable.rb', line 47

def trim_chance
  2
end

.use_skip_lockedObject



37
38
39
# File 'lib/solid_cable.rb', line 37

def use_skip_locked
  cable_config.use_skip_locked != false
end