Skip to content

Commit

Permalink
revert mobile sub location criteria to 1/day
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffgrunewald committed Aug 14, 2023
1 parent 16558aa commit 4b2e4f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mobile_verifier/src/rewarder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl Rewarder {

// clear the db of data sessions data & subscriber location data for the epoch
data_session::clear_hotspot_data_sessions(&mut transaction, reward_period).await?;
// subscriber_location::clear_location_shares(&mut transaction, reward_period).await?;
subscriber_location::clear_location_shares(&mut transaction, reward_period).await?;

let next_reward_period = scheduler.next_reward_period();
save_last_rewarded_end_time(&mut transaction, &next_reward_period.start).await?;
Expand Down
7 changes: 2 additions & 5 deletions mobile_verifier/src/subscriber_location.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use chrono::{DateTime, Duration, Utc};
use chrono::{DateTime, Utc};
use file_store::{
file_info_poller::FileInfoStream,
file_sink::FileSinkClient,
Expand All @@ -18,8 +18,6 @@ use sqlx::{PgPool, Postgres, Transaction};
use std::ops::Range;
use tokio::sync::mpsc::Receiver;

const SUBSCRIBER_REWARD_PERIOD_LENGTH_IN_DAYS: i64 = 14;

pub type SubscriberValidatedLocations = Vec<Vec<u8>>;

pub struct SubscriberLocationIngestor {
Expand Down Expand Up @@ -180,7 +178,7 @@ pub async fn aggregate_location_shares(
let mut rows = sqlx::query_as::<_, SubscriberLocationShare>(
"select distinct(subscriber_id) from subscriber_loc_verified where received_timestamp >= $1 and received_timestamp < $2",
)
.bind(reward_period.end - Duration::days(SUBSCRIBER_REWARD_PERIOD_LENGTH_IN_DAYS))
.bind(reward_period.start)
.bind(reward_period.end)
.fetch(db);
let mut location_shares = SubscriberValidatedLocations::new();
Expand All @@ -190,7 +188,6 @@ pub async fn aggregate_location_shares(
Ok(location_shares)
}

#[allow(dead_code)]
pub async fn clear_location_shares(
tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
reward_period: &Range<DateTime<Utc>>,
Expand Down

0 comments on commit 4b2e4f7

Please sign in to comment.