Skip to content

Commit

Permalink
Merge pull request #285 from coryodaniel/fix-stopping-genserver
Browse files Browse the repository at this point in the history
fix: only stop genserver if connection is closed for reading, too.
  • Loading branch information
mruoss authored Oct 17, 2023
2 parents 1297453 + b9e2a62 commit d6b5b56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- ### Added | Changed | Deprecated | Removed | Fixed | Security -->

### Fixed

- `K8s.Client.Mint.HTTPAdapter` - Only stop the process if the connection is closed for reading (and writing). - [#280](https://github.com/coryodaniel/k8s/issues/280), [#285](https://github.com/coryodaniel/k8s/pull/285)

<!--------------------- Don't add new entries after this line --------------------->

## [2.4.1] - 2023-08-15
Expand Down
4 changes: 2 additions & 2 deletions lib/k8s/client/mint/http_adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ defmodule K8s.Client.Mint.HTTPAdapter do
# it's not open, and all buffers are emptied, this process is considered
# garbage and is stopped.
def handle_info(:healthcheck, state) do
if Mint.HTTP.open?(state.conn) or any_non_empty_buffers?(state) do
if Mint.HTTP.open?(state.conn, :read) or any_non_empty_buffers?(state) do
Process.send_after(self(), :healthcheck, @healthcheck_freq * 1000)
{:noreply, state}
else
Expand Down Expand Up @@ -453,7 +453,7 @@ defmodule K8s.Client.Mint.HTTPAdapter do

@spec shutdown_if_closed(t()) :: {:noreply, t()} | {:stop, {:shutdown, :closed}, t()}
defp shutdown_if_closed(state) do
if Mint.HTTP.open?(state.conn) or any_non_empty_buffers?(state) do
if Mint.HTTP.open?(state.conn, :read) or any_non_empty_buffers?(state) do
{:noreply, state}
else
Logger.warning(
Expand Down

0 comments on commit d6b5b56

Please sign in to comment.