neiam
/apollos_crib
It's Apollo's Crib
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
GitLab: a message the worker has no clause for is logged and ignored
2d2cb58 · Gabe Morell · 2026-11-05 00:27
Message
{commit_body(@commit)}
Files changed
modified
apps/room_gitlab/lib/room_gitlab/gitlab_worker.ex
+5
−0
@@ -397,6 +397,11 @@ defmodule RoomGitlab.Worker do
| 397 | 397 | end |
| 398 | 398 | end |
| 399 | 399 | |
| 400 | + def handle_info(msg, state) do | |
| 401 | + Logger.debug("GLab::#{state.id} ignoring #{inspect(msg)}") | |
| 402 | + {:noreply, state} | |
| 403 | + end | |
| 404 | + | |
| 400 | 405 | defp store_response(state, %{write: false}, _body), do: state |
| 401 | 406 | |
| 402 | 407 | defp store_response(state, ref, body) do |
modified
apps/room_gitlab/test/gitlab_worker_test.exs
+7
−0
@@ -111,6 +111,13 @@ defmodule RoomGitlab.WorkerTest do
| 111 | 111 | assert state.refs == %{} |
| 112 | 112 | end |
| 113 | 113 | |
| 114 | + test "a message it has no use for is ignored", %{state: state} do | |
| 115 | + redirect = %HTTPoison.AsyncRedirect{id: self(), to: "https://example.com/", headers: []} | |
| 116 | + | |
| 117 | + assert Worker.handle_info(:unexpected, state) == {:noreply, state} | |
| 118 | + assert Worker.handle_info(redirect, state) == {:noreply, state} | |
| 119 | + end | |
| 120 | + | |
| 114 | 121 | defp query_jobs(state, project_ids) do |
| 115 | 122 | projects = for id <- project_ids, do: %{"id" => id} |
| 116 | 123 | Worker.handle_cast({:query_jobs, %{}}, %{state | projects: projects}) |
Parents: 98f9c28