-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update mobile verifier to record last_reward_end_time metric on boot
- Loading branch information
Showing
6 changed files
with
47 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use chrono::{DateTime, Utc}; | ||
use sqlx::{Pool, Postgres}; | ||
|
||
use crate::rewarder; | ||
|
||
const LAST_REWARDED_END_TIME: &str = "last_rewarded_end_time"; | ||
const DATA_TRANSFER_REWARDS_SCALE: &str = "data_transfer_rewards_scale"; | ||
|
||
pub async fn initialize(db: &Pool<Postgres>) -> anyhow::Result<()> { | ||
last_rewarded_end_time(rewarder::last_rewarded_end_time(db).await?); | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn last_rewarded_end_time(timestamp: DateTime<Utc>) { | ||
metrics::gauge!(LAST_REWARDED_END_TIME, timestamp.timestamp() as f64); | ||
} | ||
|
||
pub fn data_transfer_rewards_scale(scale: f64) { | ||
metrics::gauge!(DATA_TRANSFER_REWARDS_SCALE, scale); | ||
} |