Skip to content

Commit e8f8a90

Browse files
committed
sentry - analytics_recorder - check TODO and impl changes
1 parent c3325fd commit e8f8a90

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

sentry/src/analytics_recorder.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@ pub async fn record(
3434
referrer,
3535
} => {
3636
let divisor = BigNum::from(10u64.pow(18));
37-
// @Todo: Check this!
38-
let pay_amount = get_payout(&logger, &channel, event, &session)
39-
.expect("should have payout")
40-
.map(|(_, payout)| payout)
41-
.unwrap_or_default()
42-
.div_floor(&divisor)
43-
.to_f64()
44-
.expect("should always have a payout");
37+
38+
let pay_amount = match get_payout(&channel, event, &session) {
39+
Ok(Some((_, payout))) => payout.div_floor(&divisor)
40+
.to_f64()
41+
.expect("Should always have a payout in f64 after division"),
42+
// This should never happen, as the conditions we are checking for in the .filter are the same as getPayout's
43+
Ok(None) => return,
44+
Err(err) => {
45+
error!(&logger, "Getting the payout failed: {}", &err; "module" => "analytics-recorder", "err" => ?err);
46+
return
47+
},
48+
};
4549

4650
if let Some(ad_unit) = ad_unit {
4751
db.zincr(

0 commit comments

Comments
 (0)