Skip to content

Commit

Permalink
Merge pull request #53 from eigr/fix/memory-leak
Browse files Browse the repository at this point in the history
Reduces an Actor's memory usage
  • Loading branch information
sleipnir authored Sep 16, 2022
2 parents 2e64b09 + 6d0449f commit f9cf4fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions apps/actors/lib/actors/actor/entity.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ defmodule Actors.Actor.Entity do
ActorDeactivateStrategy,
ActorState,
ActorSnapshotStrategy,
ActorSystem,
TimeoutStrategy
}

Expand All @@ -34,7 +33,7 @@ defmodule Actors.Actor.Entity do
state_hash: state_hash
}

@type t :: %EntityState{system: ActorSystem.t(), actor: Actor.t(), state_hash: binary()}
@type t :: %EntityState{system: String.t(), actor: Actor.t(), state_hash: binary()}
end

@impl true
Expand Down Expand Up @@ -201,7 +200,7 @@ defmodule Actors.Actor.Entity do
} = _invocation},
_from,
%EntityState{
system: %ActorSystem{name: actor_system} = _system,
system: actor_system,
actor: %Actor{state: current_state = _actor_state} = _state_actor
} = state
)
Expand Down Expand Up @@ -260,7 +259,7 @@ defmodule Actors.Actor.Entity do
} = _invocation},
_from,
%EntityState{
system: %ActorSystem{name: actor_system} = _system,
system: actor_system,
actor: %Actor{state: %ActorState{state: current_state} = _actor_state} = _state_actor
} = state
) do
Expand Down
2 changes: 1 addition & 1 deletion apps/actors/lib/actors/actor/entity_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule Actors.Actor.Entity.Supervisor do
Adds a Actor to the dynamic supervisor.
"""
@spec lookup_or_create_actor(ActorSystem.t(), Actor.t()) :: {:ok, any}
def lookup_or_create_actor(actor_system, %Actor{} = actor) do
def lookup_or_create_actor(%ActorSystem{name: actor_system} = system, %Actor{} = actor) do
entity_state = %EntityState{system: actor_system, actor: actor}

child_spec = %{
Expand Down

0 comments on commit f9cf4fc

Please sign in to comment.