From 318d0847cef49d2cfdb024b18fe85707fdf7bd6b Mon Sep 17 00:00:00 2001 From: Dzung Nguyen Date: Thu, 22 Aug 2024 13:07:10 +0700 Subject: [PATCH] Add job_id to Logger metadata for tracking --- lib/exq/worker/server.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/exq/worker/server.ex b/lib/exq/worker/server.ex index c8d6075..8ac1630 100644 --- a/lib/exq/worker/server.ex +++ b/lib/exq/worker/server.ex @@ -21,6 +21,7 @@ defmodule Exq.Worker.Server do alias Exq.Middleware.Server, as: Middleware alias Exq.Middleware.Pipeline alias Exq.Worker.Metadata + require Logger defmodule State do defstruct job_serialized: nil, @@ -172,6 +173,7 @@ defmodule Exq.Worker.Server do {:ok, pid} = Task.start_link(fn -> :ok = Metadata.associate(metadata, self(), job) + Logger.metadata(job_id: job.jid) result = apply(worker_module, :perform, job.args) GenServer.cast(worker, {:done, result}) end)