Skip to content

Commit

Permalink
Add info publish interval to settings (#348)
Browse files Browse the repository at this point in the history
* Small fixes on docs

* Add info publish interval to settings file
  • Loading branch information
grunch authored Aug 29, 2024
1 parent 11f65c7 commit 29e6945
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions book/src/dispute.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ Mostro will send a confirmation message to the admin with the Order details:
{
"dispute": {
"version": 1,
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"id": "efc75871-2568-40b9-a6ee-c382d4d6de01",
"pubkey": null,
"action": "admin-took-dispute",
"content": {
"order": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"kind": "sell",
"status": "active",
"amount": 3333,
"amount": 7851,
"fiat_code": "VES",
"fiat_amount": 100,
"payment_method": "face to face",
Expand Down
5 changes: 4 additions & 1 deletion docker/settings.docker.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ expiration_seconds = 900
user_rates_sent_interval_seconds = 3600
# Relay list event time interval
publish_relays_interval = 60

# Requested POW
pow = 0
# Publish mostro info interval
publish_mostro_info_interval = 300

[database]
url = "sqlite:///config/mostro.db"
4 changes: 2 additions & 2 deletions settings.tpl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ user_rates_sent_interval_seconds = 3600
publish_relays_interval = 60
# Requested POW
pow = 0


# Publish mostro info interval
publish_mostro_info_interval = 300

[database]
url = "sqlite://mostro.db"
1 change: 1 addition & 0 deletions src/cli/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ pub struct Mostro {
pub max_expiration_days: u32,
pub publish_relays_interval: u32,
pub pow: u8,
pub publish_mostro_info_interval: u32,
}

impl TryFrom<Settings> for Mostro {
Expand Down
3 changes: 2 additions & 1 deletion src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ async fn job_info_event_send() {
Ok(keys) => keys,
Err(e) => return error!("{e}"),
};
let interval = Settings::get_mostro().publish_mostro_info_interval as u64;

tokio::spawn(async move {
loop {
Expand All @@ -78,7 +79,7 @@ async fn job_info_event_send() {
};
let _ = NOSTR_CLIENT.get().unwrap().send_event(info_ev).await;

tokio::time::sleep(tokio::time::Duration::from_secs(300)).await;
tokio::time::sleep(tokio::time::Duration::from_secs(interval)).await;
}
});
}
Expand Down

0 comments on commit 29e6945

Please sign in to comment.