Skip to content

Commit

Permalink
Refresh kube every 15 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriid committed Jul 11, 2019
1 parent 860a987 commit 2586550
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ config :phreak,
:kube,
config: "/Users/dmitrii.dimandt/.kube/config"

# Refresh kube once every 15 seconds
config :phreak,
Phreak.Scheduler,
jobs: [
refresh_kube: [
schedule: {:extended, "*/15"},
task: fn -> Phreak.Kube.refresh() end
]
],
debug_logging: false

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"
3 changes: 2 additions & 1 deletion lib/phreak/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ defmodule Phreak.Application do
PhreakWeb.Endpoint,
# Starts a worker by calling: Phreak.Worker.start_link(arg)
# {Phreak.Worker, arg},
{Phreak.Kube, []}
{Phreak.Kube, []},
Phreak.Scheduler
]

# See https://hexdocs.pm/elixir/Supervisor.html
Expand Down
6 changes: 6 additions & 0 deletions lib/scheduler.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
defmodule Phreak.Scheduler do
@moduledoc false

use Quantum.Scheduler,
otp_app: :phreak
end

0 comments on commit 2586550

Please sign in to comment.