We have this list of workers in lib/app.ex
file.
worker(ConCache, [[ttl_check: :timer.seconds(0.1), ttl: :timer.minutes(1)], [name: :camera_lock]], id: :camera_lock),
worker(ConCache, [[ttl_check: :timer.seconds(1), ttl: :timer.hours(1)], [name: :users]], id: :users),
worker(ConCache, [[ttl_check: :timer.seconds(1), ttl: :timer.hours(1)], [name: :camera]], id: :camera),
worker(ConCache, [[ttl_check: :timer.seconds(1), ttl: :timer.hours(1)], [name: :cameras]], id: :cameras),
worker(ConCache, [[ttl_check: :timer.seconds(1), ttl: :timer.hours(1)], [name: :camera_full]], id: :camera_full),
worker(ConCache, [[ttl_check: :timer.hours(1), ttl: :timer.hours(24)], [name: :snapshot_error]], id: :snapshot_error),
worker(ConCache, [[ttl_check: :timer.hours(2), ttl: :timer.hours(24)], [name: :camera_thumbnail]], id: :camera_thumbnail),
worker(ConCache, [[ttl_check: :timer.hours(2), ttl: :timer.hours(24)], [name: :current_camera_status]], id: :current_camera_status),
worker(ConCache, [[ttl_check: :timer.hours(2), ttl: :timer.hours(6)], [name: :camera_response_times]], id: :camera_response_times),
As lastest version of concache stated.
- Added
child_spec/1
. AConCache
child can now be specified as{ConCache, [name: :my_cache, ttl_check_interval: false]}
.
I tried changing very first one {ConCache,[ttl_check_interval: :timer.seconds(0.1), global_ttl: :timer.seconds(2.5), name: :cache]}
It works fine
but When I have other workers with an ID, it fails as when I did.
{ConCache, [ttl_check: :timer.seconds(0.1), ttl: :timer.seconds(1.5), name: :snapshot_schedule]},
It generated this error,
If using maps as child specifications, make sure the :id keys are unique.
If using a module or {module, arg} as child, use Supervisor.child_spec/2 to change the :id, for example:
children = [
Supervisor.child_spec({MyWorker, arg}, id: :my_worker_1),
Supervisor.child_spec({MyWorker, arg}, id: :my_worker_2)
]
** (Mix) Could not start application evercam_media: EvercamMedia.start(:normal, []) returned an error: bad child specification, more than one child specification has the id: ConCache.
If using maps as child specifications, make sure the :id keys are unique.
If using a module or {module, arg} as child, use Supervisor.child_spec/2 to change the :id, for example:
children = [
Supervisor.child_spec({MyWorker, arg}, id: :my_worker_1),
Supervisor.child_spec({MyWorker, arg}, id: :my_worker_2)
]
Can anyone tell if thats possible to still use it with an ID? which it seems not possible at this time?