Skip to content

Commit

Permalink
VIP - delete some tests and add :ok for handler event
Browse files Browse the repository at this point in the history
  • Loading branch information
shahryarjb committed Jun 29, 2024
1 parent c64465c commit 639521c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/event/event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ defmodule MishkaInstaller.Event.Event do
deps_list <- allowed_events(data.depends),
{:ok, db_plg} <- write(:id, data.id, depends_status(deps_list, :restarted)),
:ok <- plugin_status(db_plg.status),
_ok <- EventHandler.do_compile(db_plg.event, :restart, queue) do
:ok <- EventHandler.do_compile(db_plg.event, :restart, queue) do
{:ok, db_plg}
end
end
Expand Down Expand Up @@ -395,7 +395,7 @@ defmodule MishkaInstaller.Event.Event do
with {:ok, data} <- exist_record?(get(:name, name)),
:ok <- plugin_status(data.status),
{:ok, db_plg} <- write(:id, data.id, %{status: :stopped}),
_ok <- EventHandler.do_compile(db_plg.event, :stop, queue) do
:ok <- EventHandler.do_compile(db_plg.event, :stop, queue) do
{:ok, db_plg}
end
end
Expand Down Expand Up @@ -486,7 +486,7 @@ defmodule MishkaInstaller.Event.Event do
def unregister(:name, name, queue) do
with {:ok, db_plg} <- delete(:name, name),
:ok <- GenServer.stop(name, :normal),
_ok <- EventHandler.do_compile(db_plg.event, :unregister, queue) do
:ok <- EventHandler.do_compile(db_plg.event, :unregister, queue) do
{:ok, db_plg}
end
end
Expand Down
9 changes: 0 additions & 9 deletions test/event/event_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -668,15 +668,6 @@ defmodule MishkaInstallerTest.Event.EventTest do
{:ok, _unregister_data} = assert Event.unregister(:name, RegisterEmailSender, true)

assert_receive %{status: :unregister, data: _data}, 3000

assert_receive %{status: :purge_create, data: _data}, 3000

assert !Process.alive?(pid)

assert is_nil(Event.get(:name, RegisterEmailSender))

module = ModuleStateCompiler.module_event_name("after_success_login")
%{module: _, plugins: []} = assert module.initialize()
end

test "Unregister a plugin - queue false" do
Expand Down

0 comments on commit 639521c

Please sign in to comment.