Skip to content

Commit

Permalink
fix(swap): use tmp file for swap and order files (#2118)
Browse files Browse the repository at this point in the history
This avoids concurrent reading/writing by enabling .tmp file for swap and order files. This fix should not create a problem for two mm2 instances running on the same node as both would use different directories for their data, derived from different listening IP-addresses.
  • Loading branch information
dimxy authored May 14, 2024
1 parent 52326c4 commit 29c48bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/lp_ordermatch/my_orders_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ mod native_impl {
my_taker_order_file_path, my_taker_orders_dir};
use mm2_io::fs::{read_dir_json, read_json, remove_file_async, write_json, FsJsonError};

const USE_TMP_FILE: bool = false;
const USE_TMP_FILE: bool = true;

impl From<FsJsonError> for MyOrdersError {
fn from(fs: FsJsonError) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/lp_swap/saved_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ mod native_impl {
use crate::mm2::lp_swap::{my_swap_file_path, my_swaps_dir};
use mm2_io::fs::{read_dir_json, read_json, write_json, FsJsonError};

const USE_TMP_FILE: bool = false;
const USE_TMP_FILE: bool = true;

impl From<FsJsonError> for SavedSwapError {
fn from(fs: FsJsonError) -> Self {
Expand Down

0 comments on commit 29c48bb

Please sign in to comment.