Skip to content

Commit

Permalink
Merge pull request #89 from beardedeagle/0.3.12
Browse files Browse the repository at this point in the history
Use table_load_timeout for get_table_cookies
  • Loading branch information
beardedeagle authored May 6, 2023
2 parents e0ce918 + 3933dcd commit 7603cae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [[0.3.11]] - 2023-05-04
### ADDED
## [[0.3.12]] - 2023-05-06
### Changed
- Changed `get_table_cookies/1` and `get_table_cookies/2` to utilize `table_load_timeout/0` for `:rpc.call/5` calls.

## [[0.3.11]] - 2023-05-06
### Added
- Added test to ensure `get_table_cookies/1` returns error when node is not reachable.

### Fixed
Expand All @@ -17,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated dependencies.
- Updated GitHub repo files.

### FIXED
### Fixed
- Updated `get_table_cookies/1` to use `:local_tables` instead of `:tables` to properly identify table copies that don't exist locally to a given node, closes #84.

## [[0.3.9]] - 2021-02-21
Expand Down Expand Up @@ -108,6 +112,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial release.

[0.3.12]: https://github.com/beardedeagle/mnesiac/compare/v0.3.11...v0.3.12
[0.3.11]: https://github.com/beardedeagle/mnesiac/compare/v0.3.10...v0.3.11
[0.3.10]: https://github.com/beardedeagle/mnesiac/compare/v0.3.9...v0.3.10
[0.3.9]: https://github.com/beardedeagle/mnesiac/compare/v0.3.8...v0.3.9
Expand Down
4 changes: 2 additions & 2 deletions lib/mnesiac/store_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ defmodule Mnesiac.StoreManager do
This function returns a map of tables and their cookies.
"""
def get_table_cookies(node \\ node()) do
case :rpc.call(node, :mnesia, :system_info, [:local_tables], 5_000) do
case :rpc.call(node, :mnesia, :system_info, [:local_tables], table_load_timeout()) do
{:badrpc, reason} ->
{:error, reason}

Expand All @@ -137,7 +137,7 @@ defmodule Mnesiac.StoreManager do

defp get_table_cookies(node, tables) do
Enum.reduce_while(tables, {:ok, %{}}, fn table, {:ok, acc} ->
case :rpc.call(node, :mnesia, :table_info, [table, :cookie], 5_000) do
case :rpc.call(node, :mnesia, :table_info, [table, :cookie], table_load_timeout()) do
{:badrpc, reason} ->
{:halt, {:error, reason}}

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Mnesiac.MixProject do
def project do
[
app: :mnesiac,
version: "0.3.11",
version: "0.3.12",
elixir: "~> 1.8",
elixirc_paths: elixirc_paths(Mix.env()),
test_coverage: [tool: ExCoveralls],
Expand Down

0 comments on commit 7603cae

Please sign in to comment.