Compare commits

...

34 Commits

Author SHA1 Message Date
CI
a3c41e84e4 chore: release version v1.66.18 2025-06-07 14:55:06 +00:00
Dmitry Popov
7f21f33351 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-07 16:54:40 +02:00
Dmitry Popov
568f682cee chore: release version v1.66.16 2025-06-07 16:54:36 +02:00
CI
901c4c8ca4 chore: release version v1.66.17 2025-06-07 14:44:50 +00:00
Dmitry Popov
3dbba97f9c fix(Core): Increased tracking pause timeout for offline characters up to 10 hours 2025-06-07 16:44:18 +02:00
CI
3475620267 chore: release version v1.66.16 2025-06-07 13:41:56 +00:00
Dmitry Popov
8936a5e5d8 chore: release version v1.66.15 2025-06-07 15:41:22 +02:00
Dmitry Popov
719e34f9bc fix(Core): Increased tracking pause timeout for offline characters up to 10 hours 2025-06-07 15:41:06 +02:00
CI
4dc74022b4 chore: release version v1.66.15 2025-06-07 09:01:44 +00:00
Dmitry Popov
c2b7d07208 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-07 10:58:35 +02:00
Dmitry Popov
21e76a6f05 fix(Core): Added back arm docker image build 2025-06-07 10:58:24 +02:00
CI
89c0d6fad6 chore: release version v1.66.14 2025-06-07 08:48:05 +00:00
Dmitry Popov
b74d15b1ee Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-07 10:47:31 +02:00
Dmitry Popov
10313438bf fix(Core): fixed online updates 2025-06-07 10:47:28 +02:00
CI
a764217948 chore: release version v1.66.13 2025-06-07 07:49:31 +00:00
Dmitry Popov
d81d6fb937 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-07 09:48:56 +02:00
Dmitry Popov
4c0f7ab7f9 fix(Core): fixed location tracking issues 2025-06-07 09:48:53 +02:00
CI
1c48945a96 chore: release version v1.66.12
Some checks failed
Build / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build / merge (push) Has been cancelled
Build / 🏷 Create Release (push) Has been cancelled
2025-06-06 23:58:04 +00:00
Dmitry Popov
850901f62f Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-07 01:57:37 +02:00
Dmitry Popov
4822854e30 chore: release version v1.66.10 2025-06-07 01:57:32 +02:00
CI
f580538331 chore: release version v1.66.11 2025-06-06 23:47:37 +00:00
Dmitry Popov
0d70c555e6 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-07 01:47:07 +02:00
Dmitry Popov
c5f6cf0080 fix(Core): fixed refresh character tokens 2025-06-07 01:47:03 +02:00
CI
6ff7b3bc9a chore: release version v1.66.10
Some checks failed
Build / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build / merge (push) Has been cancelled
Build / 🏷 Create Release (push) Has been cancelled
2025-06-06 22:37:51 +00:00
Dmitry Popov
346c2c65b0 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-07 00:37:23 +02:00
Dmitry Popov
a6445fd500 chore: release version v1.66.8 2025-06-07 00:37:20 +02:00
CI
358e43e508 chore: release version v1.66.9 2025-06-06 22:23:05 +00:00
Dmitry Popov
20c5ba6b63 chore: release version v1.66.8 2025-06-07 00:22:35 +02:00
CI
661658a6e8 chore: release version v1.66.8 2025-06-06 21:32:10 +00:00
Dmitry Popov
0a6f224ed3 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-06 23:31:41 +02:00
Dmitry Popov
e7bb29693f fix: fixed disable detailed kills env check 2025-06-06 23:31:38 +02:00
CI
32dfd50461 chore: release version v1.66.7 2025-06-06 20:34:16 +00:00
Dmitry Popov
bfec385dce Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-06-06 22:33:49 +02:00
Dmitry Popov
04278f99d7 fix: fixed disable detailed kills env check 2025-06-06 22:33:46 +02:00
10 changed files with 354 additions and 129 deletions

View File

@@ -116,6 +116,7 @@ jobs:
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Prepare
run: |

View File

@@ -2,6 +2,98 @@
<!-- changelog -->
## [v1.66.18](https://github.com/wanderer-industries/wanderer/compare/v1.66.17...v1.66.18) (2025-06-07)
## [v1.66.17](https://github.com/wanderer-industries/wanderer/compare/v1.66.16...v1.66.17) (2025-06-07)
### Bug Fixes:
* Core: Increased tracking pause timeout for offline characters up to 10 hours
## [v1.66.16](https://github.com/wanderer-industries/wanderer/compare/v1.66.15...v1.66.16) (2025-06-07)
### Bug Fixes:
* Core: Increased tracking pause timeout for offline characters up to 10 hours
## [v1.66.15](https://github.com/wanderer-industries/wanderer/compare/v1.66.14...v1.66.15) (2025-06-07)
### Bug Fixes:
* Core: Added back arm docker image build
## [v1.66.14](https://github.com/wanderer-industries/wanderer/compare/v1.66.13...v1.66.14) (2025-06-07)
### Bug Fixes:
* Core: fixed online updates
## [v1.66.13](https://github.com/wanderer-industries/wanderer/compare/v1.66.12...v1.66.13) (2025-06-07)
### Bug Fixes:
* Core: fixed location tracking issues
## [v1.66.12](https://github.com/wanderer-industries/wanderer/compare/v1.66.11...v1.66.12) (2025-06-06)
## [v1.66.11](https://github.com/wanderer-industries/wanderer/compare/v1.66.10...v1.66.11) (2025-06-06)
### Bug Fixes:
* Core: fixed refresh character tokens
## [v1.66.10](https://github.com/wanderer-industries/wanderer/compare/v1.66.9...v1.66.10) (2025-06-06)
## [v1.66.9](https://github.com/wanderer-industries/wanderer/compare/v1.66.8...v1.66.9) (2025-06-06)
## [v1.66.8](https://github.com/wanderer-industries/wanderer/compare/v1.66.7...v1.66.8) (2025-06-06)
### Bug Fixes:
* fixed disable detailed kills env check
## [v1.66.7](https://github.com/wanderer-industries/wanderer/compare/v1.66.6...v1.66.7) (2025-06-06)
### Bug Fixes:
* fixed disable detailed kills env check
## [v1.66.6](https://github.com/wanderer-industries/wanderer/compare/v1.66.5...v1.66.6) (2025-06-06)

View File

@@ -53,16 +53,6 @@ public_api_disabled =
|> get_var_from_path_or_env("WANDERER_PUBLIC_API_DISABLED", "false")
|> String.to_existing_atom()
character_api_disabled =
config_dir
|> get_var_from_path_or_env("WANDERER_CHARACTER_API_DISABLED", "true")
|> String.to_existing_atom()
zkill_preload_disabled =
config_dir
|> get_var_from_path_or_env("WANDERER_ZKILL_PRELOAD_DISABLED", "false")
|> String.to_existing_atom()
map_subscriptions_enabled =
config_dir
|> get_var_from_path_or_env("WANDERER_MAP_SUBSCRIPTIONS_ENABLED", "false")
@@ -128,8 +118,10 @@ config :wanderer_app,
corp_id: System.get_env("WANDERER_CORP_ID", "-1") |> String.to_integer(),
corp_wallet: System.get_env("WANDERER_CORP_WALLET", ""),
public_api_disabled: public_api_disabled,
character_api_disabled: character_api_disabled,
zkill_preload_disabled: zkill_preload_disabled,
character_api_disabled:
System.get_env("WANDERER_CHARACTER_API_DISABLED", "true") |> String.to_existing_atom(),
zkill_preload_disabled:
System.get_env("WANDERER_ZKILL_PRELOAD_DISABLED", "false") |> String.to_existing_atom(),
map_subscriptions_enabled: map_subscriptions_enabled,
map_connection_auto_expire_hours: map_connection_auto_expire_hours,
map_connection_auto_eol_hours: map_connection_auto_eol_hours,

View File

@@ -33,12 +33,15 @@ defmodule WandererApp.Character.Tracker do
status: binary()
}
@pause_tracking_timeout :timer.minutes(5)
@online_error_timeout :timer.minutes(1)
@pause_tracking_timeout :timer.minutes(60 * 10)
@online_error_timeout :timer.minutes(2)
@ship_error_timeout :timer.minutes(2)
@location_error_timeout :timer.minutes(2)
@online_forbidden_ttl :timer.seconds(7)
@online_limit_ttl :timer.seconds(5)
@online_limit_ttl :timer.seconds(7)
@forbidden_ttl :timer.seconds(5)
@limit_ttl :timer.seconds(5)
@location_limit_ttl :timer.seconds(1)
@pubsub_client Application.compile_env(:wanderer_app, :pubsub_client)
def new(), do: __struct__()
@@ -53,8 +56,17 @@ defmodule WandererApp.Character.Tracker do
|> new()
end
def check_online_errors(character_id) do
WandererApp.Cache.lookup!("character:#{character_id}:online_error_time")
def check_online_errors(character_id),
do: check_tracking_errors(character_id, "online", @online_error_timeout)
def check_ship_errors(character_id),
do: check_tracking_errors(character_id, "ship", @ship_error_timeout)
def check_location_errors(character_id),
do: check_tracking_errors(character_id, "location", @location_error_timeout)
defp check_tracking_errors(character_id, type, timeout) do
WandererApp.Cache.lookup!("character:#{character_id}:#{type}_error_time")
|> case do
nil ->
:skip
@@ -62,34 +74,8 @@ defmodule WandererApp.Character.Tracker do
error_time ->
duration = DateTime.diff(DateTime.utc_now(), error_time, :millisecond)
if duration >= @online_error_timeout do
WandererApp.Cache.delete("character:#{character_id}:online_forbidden")
WandererApp.Cache.delete("character:#{character_id}:online_error_time")
WandererApp.Character.update_character(character_id, %{online: false})
WandererApp.Character.update_character_state(character_id, %{
is_online: false
})
WandererApp.Cache.put(
"character:#{character_id}:tracking_paused",
true,
ttl: @pause_tracking_timeout
)
{:ok, %{solar_system_id: solar_system_id}} =
WandererApp.Character.get_character(character_id)
{:ok, %{active_maps: active_maps}} =
WandererApp.Character.get_character_state(character_id)
active_maps
|> Enum.each(fn map_id ->
WandererApp.Cache.put(
"map:#{map_id}:character:#{character_id}:start_solar_system_id",
solar_system_id
)
end)
if duration >= timeout do
pause_tracking(character_id)
:ok
else
@@ -98,6 +84,40 @@ defmodule WandererApp.Character.Tracker do
end
end
defp pause_tracking(character_id) do
WandererApp.Cache.delete("character:#{character_id}:online_forbidden")
WandererApp.Cache.delete("character:#{character_id}:online_error_time")
WandererApp.Cache.delete("character:#{character_id}:ship_error_time")
WandererApp.Cache.delete("character:#{character_id}:location_error_time")
WandererApp.Character.update_character(character_id, %{online: false})
WandererApp.Character.update_character_state(character_id, %{
is_online: false
})
Logger.warning("[CharacterTracker] paused for #{character_id}")
WandererApp.Cache.put(
"character:#{character_id}:tracking_paused",
true,
ttl: @pause_tracking_timeout
)
{:ok, %{solar_system_id: solar_system_id}} =
WandererApp.Character.get_character(character_id)
{:ok, %{active_maps: active_maps}} =
WandererApp.Character.get_character_state(character_id)
active_maps
|> Enum.each(fn map_id ->
WandererApp.Cache.put(
"map:#{map_id}:character:#{character_id}:start_solar_system_id",
solar_system_id
)
end)
end
def update_settings(character_id, track_settings) do
{:ok, character_state} = WandererApp.Character.get_character_state(character_id)
@@ -129,24 +149,15 @@ defmodule WandererApp.Character.Tracker do
_ ->
case WandererApp.Esi.get_character_online(eve_id,
access_token: access_token,
character_id: character_id,
refresh_token?: true
character_id: character_id
) do
{:ok, online} ->
online = get_online(online)
WandererApp.Cache.delete("character:#{character_id}:online_forbidden")
if is_nil(
WandererApp.Cache.lookup!("character:#{character_id}:online_error_time")
) do
WandererApp.Cache.insert(
"character:#{character_id}:online_error_time",
DateTime.utc_now()
)
end
# WandererApp.Cache.delete("character:#{character_id}:online_error_time")
WandererApp.Cache.delete("character:#{character_id}:online_error_time")
WandererApp.Cache.delete("character:#{character_id}:ship_error_time")
WandererApp.Cache.delete("character:#{character_id}:location_error_time")
WandererApp.Cache.delete("character:#{character_id}:info_forbidden")
WandererApp.Cache.delete("character:#{character_id}:ship_forbidden")
WandererApp.Cache.delete("character:#{character_id}:location_forbidden")
@@ -197,15 +208,6 @@ defmodule WandererApp.Character.Tracker do
ttl: reset_timeout
)
if is_nil(
WandererApp.Cache.lookup!("character:#{character_id}:online_error_time")
) do
WandererApp.Cache.insert(
"character:#{character_id}:online_error_time",
DateTime.utc_now()
)
end
{:error, :skipped}
{:error, error} ->
@@ -240,14 +242,20 @@ defmodule WandererApp.Character.Tracker do
def update_online(_), do: {:error, :skipped}
defp get_reset_timeout(%{"x-esi-error-limit-reset" => [reset_seconds]})
defp get_reset_timeout(_headers, _default_timeout \\ @limit_ttl)
defp get_reset_timeout(
%{"x-esi-error-limit-remain" => ["0"], "x-esi-error-limit-reset" => [reset_seconds]},
_default_timeout
)
when is_binary(reset_seconds),
do: :timer.seconds((reset_seconds |> String.to_integer()) + 1)
defp get_reset_timeout(_headers), do: @limit_ttl
defp get_reset_timeout(_headers, default_timeout), do: default_timeout
def update_info(character_id) do
(WandererApp.Cache.has_key?("character:#{character_id}:info_forbidden") ||
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
WandererApp.Cache.has_key?("character:#{character_id}:info_forbidden") ||
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|> case do
true ->
@@ -320,7 +328,8 @@ defmodule WandererApp.Character.Tracker do
|> WandererApp.Character.get_character()
|> case do
{:ok, %{eve_id: eve_id, access_token: access_token}} when not is_nil(access_token) ->
(WandererApp.Cache.has_key?("character:#{character_id}:ship_forbidden") ||
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
WandererApp.Cache.has_key?("character:#{character_id}:ship_forbidden") ||
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|> case do
true ->
@@ -329,8 +338,7 @@ defmodule WandererApp.Character.Tracker do
_ ->
case WandererApp.Esi.get_character_ship(eve_id,
access_token: access_token,
character_id: character_id,
refresh_token?: true
character_id: character_id
) do
{:ok, ship} when is_non_struct_map(ship) ->
character_state |> maybe_update_ship(ship)
@@ -346,6 +354,13 @@ defmodule WandererApp.Character.Tracker do
ttl: @forbidden_ttl
)
if is_nil(WandererApp.Cache.lookup!("character:#{character_id}:ship_error_time")) do
WandererApp.Cache.insert(
"character:#{character_id}:ship_error_time",
DateTime.utc_now()
)
end
{:error, error}
{:error, :error_limited, headers} ->
@@ -370,6 +385,13 @@ defmodule WandererApp.Character.Tracker do
ttl: @forbidden_ttl
)
if is_nil(WandererApp.Cache.lookup!("character:#{character_id}:ship_error_time")) do
WandererApp.Cache.insert(
"character:#{character_id}:ship_error_time",
DateTime.utc_now()
)
end
{:error, error}
_ ->
@@ -381,6 +403,13 @@ defmodule WandererApp.Character.Tracker do
ttl: @forbidden_ttl
)
if is_nil(WandererApp.Cache.lookup!("character:#{character_id}:ship_error_time")) do
WandererApp.Cache.insert(
"character:#{character_id}:ship_error_time",
DateTime.utc_now()
)
end
{:error, :skipped}
end
end
@@ -412,8 +441,7 @@ defmodule WandererApp.Character.Tracker do
_ ->
case WandererApp.Esi.get_character_location(eve_id,
access_token: access_token,
character_id: character_id,
refresh_token?: true
character_id: character_id
) do
{:ok, location} when is_non_struct_map(location) ->
character_state
@@ -424,21 +452,24 @@ defmodule WandererApp.Character.Tracker do
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
Logger.warning("#{__MODULE__} failed to update_location: #{inspect(error)}")
WandererApp.Cache.put(
"character:#{character_id}:location_forbidden",
true,
ttl: @forbidden_ttl
)
if is_nil(
WandererApp.Cache.lookup!("character:#{character_id}:location_error_time")
) do
WandererApp.Cache.insert(
"character:#{character_id}:location_error_time",
DateTime.utc_now()
)
end
{:error, error}
{:error, :skipped}
{:error, :error_limited, headers} ->
reset_timeout = get_reset_timeout(headers)
Logger.warning(
"#{__MODULE__} failed to update_location: #{inspect(:error_limited)}"
)
reset_timeout = get_reset_timeout(headers, @location_limit_ttl)
WandererApp.Cache.put(
"character:#{character_id}:location_forbidden",
true,
@@ -450,22 +481,28 @@ defmodule WandererApp.Character.Tracker do
{:error, error} ->
Logger.error("#{__MODULE__} failed to update_location: #{inspect(error)}")
WandererApp.Cache.put(
"character:#{character_id}:location_forbidden",
true,
ttl: @forbidden_ttl
)
if is_nil(
WandererApp.Cache.lookup!("character:#{character_id}:location_error_time")
) do
WandererApp.Cache.insert(
"character:#{character_id}:location_error_time",
DateTime.utc_now()
)
end
{:error, error}
{:error, :skipped}
_ ->
Logger.error("#{__MODULE__} failed to update_location: wrong response")
WandererApp.Cache.put(
"character:#{character_id}:location_forbidden",
true,
ttl: @forbidden_ttl
)
if is_nil(
WandererApp.Cache.lookup!("character:#{character_id}:location_error_time")
) do
WandererApp.Cache.insert(
"character:#{character_id}:location_error_time",
DateTime.utc_now()
)
end
{:error, :skipped}
end
@@ -491,7 +528,8 @@ defmodule WandererApp.Character.Tracker do
|> WandererApp.Character.can_track_wallet?()
|> case do
true ->
(WandererApp.Cache.has_key?("character:#{character_id}:wallet_forbidden") ||
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
WandererApp.Cache.has_key?("character:#{character_id}:wallet_forbidden") ||
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|> case do
true ->
@@ -501,8 +539,7 @@ defmodule WandererApp.Character.Tracker do
case WandererApp.Esi.get_character_wallet(eve_id,
params: %{datasource: "tranquility"},
access_token: access_token,
character_id: character_id,
refresh_token?: true
character_id: character_id
) do
{:ok, result} ->
{:ok, state} = WandererApp.Character.get_character_state(character_id)
@@ -570,7 +607,8 @@ defmodule WandererApp.Character.Tracker do
end
defp update_alliance(%{character_id: character_id} = state, alliance_id) do
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused")
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|> case do
true ->
state
@@ -609,7 +647,8 @@ defmodule WandererApp.Character.Tracker do
end
defp update_corporation(%{character_id: character_id} = state, corporation_id) do
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused")
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|> case do
true ->
state

View File

@@ -16,9 +16,11 @@ defmodule WandererApp.Character.TrackerPool do
@registry :tracker_pool_registry
@unique_registry :unique_tracker_pool_registry
@update_location_interval :timer.seconds(2)
@update_location_interval :timer.seconds(1)
@update_online_interval :timer.seconds(5)
@check_online_errors_interval :timer.seconds(30)
@check_online_errors_interval :timer.minutes(1)
@check_ship_errors_interval :timer.minutes(1)
@check_location_errors_interval :timer.minutes(1)
@update_ship_interval :timer.seconds(2)
@update_info_interval :timer.minutes(1)
@update_wallet_interval :timer.minutes(1)
@@ -116,7 +118,9 @@ defmodule WandererApp.Character.TrackerPool do
)
Process.send_after(self(), :update_online, 100)
Process.send_after(self(), :check_online_errors, @check_online_errors_interval)
Process.send_after(self(), :check_online_errors, :timer.seconds(60))
Process.send_after(self(), :check_ship_errors, :timer.seconds(90))
Process.send_after(self(), :check_location_errors, :timer.seconds(120))
Process.send_after(self(), :update_location, 300)
Process.send_after(self(), :update_ship, 500)
Process.send_after(self(), :update_info, 1500)
@@ -243,6 +247,86 @@ defmodule WandererApp.Character.TrackerPool do
{:noreply, state}
end
def handle_info(
:check_ship_errors,
%{
characters: characters
} =
state
) do
Process.send_after(self(), :check_ship_errors, @check_ship_errors_interval)
try do
characters
|> Task.async_stream(
fn character_id ->
WandererApp.TaskWrapper.start_link(
WandererApp.Character.Tracker,
:check_ship_errors,
[
character_id
]
)
end,
timeout: :timer.seconds(15),
max_concurrency: System.schedulers_online(),
on_timeout: :kill_task
)
|> Enum.each(fn
{:ok, _result} -> :ok
{:error, reason} -> @logger.error("Error in check_ship_errors: #{inspect(reason)}")
end)
rescue
e ->
Logger.error("""
[Tracker Pool] check_ship_errors => exception: #{Exception.message(e)}
#{Exception.format_stacktrace(__STACKTRACE__)}
""")
end
{:noreply, state}
end
def handle_info(
:check_location_errors,
%{
characters: characters
} =
state
) do
Process.send_after(self(), :check_location_errors, @check_location_errors_interval)
try do
characters
|> Task.async_stream(
fn character_id ->
WandererApp.TaskWrapper.start_link(
WandererApp.Character.Tracker,
:check_location_errors,
[
character_id
]
)
end,
timeout: :timer.seconds(15),
max_concurrency: System.schedulers_online(),
on_timeout: :kill_task
)
|> Enum.each(fn
{:ok, _result} -> :ok
{:error, reason} -> @logger.error("Error in check_location_errors: #{inspect(reason)}")
end)
rescue
e ->
Logger.error("""
[Tracker Pool] check_location_errors => exception: #{Exception.message(e)}
#{Exception.format_stacktrace(__STACKTRACE__)}
""")
end
{:noreply, state}
end
def handle_info(
:update_location,
%{

View File

@@ -7,7 +7,7 @@ defmodule WandererApp.Character.TrackerPoolDynamicSupervisor do
@cache :tracked_characters
@registry :tracker_pool_registry
@unique_registry :unique_tracker_pool_registry
@tracker_pool_limit 100
@tracker_pool_limit 50
@name __MODULE__

View File

@@ -145,13 +145,15 @@ defmodule WandererApp.Character.TransactionsTracker.Impl do
end
defp get_wallet_journal(
%{corporation_id: corporation_id, access_token: access_token} = _character,
%{id: character_id, corporation_id: corporation_id, access_token: access_token} =
_character,
division
)
when not is_nil(access_token) do
case WandererApp.Esi.get_corporation_wallet_journal(corporation_id, division,
params: %{datasource: "tranquility"},
access_token: access_token
access_token: access_token,
character_id: character_id
) do
{:ok, result} ->
{:corporation_wallet_journal, result}
@@ -173,12 +175,14 @@ defmodule WandererApp.Character.TransactionsTracker.Impl do
defp get_wallet_journal(_character, _division), do: {:error, :skipped}
defp update_corp_wallets(
%{corporation_id: corporation_id, access_token: access_token} = _character
%{id: character_id, corporation_id: corporation_id, access_token: access_token} =
_character
)
when not is_nil(access_token) do
case WandererApp.Esi.get_corporation_wallets(corporation_id,
params: %{datasource: "tranquility"},
access_token: access_token
access_token: access_token,
character_id: character_id
) do
{:ok, result} ->
{:corporation_wallets, result}

View File

@@ -463,10 +463,10 @@ defmodule WandererApp.Esi.ApiClient do
get(
path,
auth_opts,
opts
opts |> with_refresh_token()
)
else
get_retry(path, auth_opts, opts)
get_retry(path, auth_opts, opts |> with_refresh_token())
end
end
@@ -485,7 +485,7 @@ defmodule WandererApp.Esi.ApiClient do
"/corporations/#{corporation_eve_id}/#{info_path}",
[params: opts[:params] || []] ++
(opts |> get_auth_opts()),
opts ++ @cache_opts
(opts |> with_refresh_token()) ++ @cache_opts
)
defp with_user_agent_opts(opts) do
@@ -495,6 +495,10 @@ defmodule WandererApp.Esi.ApiClient do
)
end
defp with_refresh_token(opts) do
opts |> Keyword.merge(refresh_token?: true)
end
defp with_cache_opts(opts) do
opts |> Keyword.merge(@cache_opts) |> Keyword.merge(cache_dir: System.tmp_dir!())
end

View File

@@ -17,28 +17,37 @@ defmodule WandererApp.Zkb.KillsProvider.Fetcher do
"""
def fetch_kills_for_systems(system_ids, since_hours, state, _opts \\ [])
when is_list(system_ids) do
try do
{final_map, final_state} =
Enum.reduce(system_ids, {%{}, state}, fn sid, {acc_map, acc_st} ->
case fetch_kills_for_system(sid, since_hours, acc_st) do
{:ok, kills, new_st} ->
{Map.put(acc_map, sid, kills), new_st}
zkill_preload_disabled = WandererApp.Env.zkill_preload_disabled?()
{:error, reason, new_st} ->
Logger.debug(fn -> "[Fetcher] system=#{sid} => error=#{inspect(reason)}" end)
{Map.put(acc_map, sid, {:error, reason}), new_st}
end
if not zkill_preload_disabled do
try do
{final_map, final_state} =
Enum.reduce(system_ids, {%{}, state}, fn sid, {acc_map, acc_st} ->
case fetch_kills_for_system(sid, since_hours, acc_st) do
{:ok, kills, new_st} ->
{Map.put(acc_map, sid, kills), new_st}
{:error, reason, new_st} ->
Logger.debug(fn -> "[Fetcher] system=#{sid} => error=#{inspect(reason)}" end)
{Map.put(acc_map, sid, {:error, reason}), new_st}
end
end)
Logger.debug(fn ->
"[Fetcher] fetch_kills_for_systems => done, final_map_size=#{map_size(final_map)} calls=#{final_state.calls_count}"
end)
Logger.debug(fn ->
"[Fetcher] fetch_kills_for_systems => done, final_map_size=#{map_size(final_map)} calls=#{final_state.calls_count}"
end)
{:ok, final_map}
rescue
e ->
Logger.error(
"[Fetcher] EXCEPTION in fetch_kills_for_systems => #{Exception.message(e)}"
)
{:ok, final_map}
rescue
e ->
Logger.error("[Fetcher] EXCEPTION in fetch_kills_for_systems => #{Exception.message(e)}")
{:error, e}
{:error, e}
end
else
{:error, :kills_disabled}
end
end

View File

@@ -3,7 +3,7 @@ defmodule WandererApp.MixProject do
@source_url "https://github.com/wanderer-industries/wanderer"
@version "1.66.6"
@version "1.66.18"
def project do
[