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.
spawn pid, kill pid per task
9b15c93 · gmorell · 2023-07-28 15:03
Files changed
modified
apps/room_gtfs/lib/room_gtfs/gtfs_worker.ex
+6
−5
@@ -403,13 +403,13 @@ defmodule RoomGtfs.Worker.Static do
| 403 | 403 | |
| 404 | 404 | def init(opts) do |
| 405 | 405 | |
| 406 | − pgopts = RoomSanctum.Repo.config() | |
| 407 | − {:ok, pid} = Postgrex.start_link(pgopts) | |
| 406 | +# pgopts = RoomSanctum.Repo.config() | |
| 407 | +# {:ok, pid} = Postgrex.start_link(pgopts) | |
| 408 | 408 | |
| 409 | 409 | {:ok, |
| 410 | 410 | %{ |
| 411 | 411 | id: opts[:name], |
| 412 | − pg_pid: pid | |
| 412 | +# pg_pid: pid | |
| 413 | 413 | }} |
| 414 | 414 | end |
| 415 | 415 |
@@ -522,7 +522,7 @@ end
| 522 | 522 | |
| 523 | 523 | # IO.inspect({table, columns, pg_cols}) |
| 524 | 524 | opts = RoomSanctum.Repo.config() |
| 525 | −# {:ok, pid} = Postgrex.start_link(opts) | |
| 525 | + {:ok, pid} = Postgrex.start_link(opts) | |
| 526 | 526 | |
| 527 | 527 | tmp_table_name = "tmp_#{type}_#{id}" |
| 528 | 528 |
@@ -592,6 +592,7 @@ end
| 592 | 592 | end, |
| 593 | 593 | timeout: :infinity |
| 594 | 594 | ) |> IO.inspect |
| 595 | + GenServer.stop(pid) | |
| 595 | 596 | end |
| 596 | 597 | |
| 597 | 598 | defp write_file(contents, type, id) do |
@@ -785,7 +786,7 @@ end
| 785 | 786 | bcast(state.id, file_to_atom(e.file_name), file_to_order(e.file_name), 9) |
| 786 | 787 | |
| 787 | 788 | Unzip.file_stream!(unzip, e.file_name) |
| 788 | − |> write_file(file_to_atom(e.file_name), state.id, state.pg_pid) | |
| 789 | + |> write_file(file_to_atom(e.file_name), state.id, nil) | |
| 789 | 790 | |
| 790 | 791 | # bcast(state.id, :stop_times, 8, 9) |
| 791 | 792 | end |
Parents: b4c7723