@@ -9,9 +9,9 @@ use adex_primitives::{
9
9
Address , BigNum , CampaignId , ToHex , UnifiedNum , IPFS ,
10
10
} ;
11
11
use async_std:: { sync:: RwLock , task:: block_on} ;
12
- use chrono:: { DateTime , Utc } ;
13
- use lazy_static:: lazy_static;
12
+ use chrono:: { DateTime , Duration , Utc } ;
14
13
use num_integer:: Integer ;
14
+ use once_cell:: sync:: Lazy ;
15
15
use rand:: Rng ;
16
16
use reqwest:: StatusCode ;
17
17
use serde:: { Deserialize , Serialize } ;
@@ -33,11 +33,10 @@ const WAIT_FOR_IMPRESSION: u32 = 8000;
33
33
// The number of impressions (won auctions) kept in history
34
34
const HISTORY_LIMIT : u32 = 50 ;
35
35
36
- lazy_static ! {
37
- // Impression "stickiness" time: see https://github.com/AdExNetwork/adex-adview-manager/issues/65
38
- // 4 minutes allows ~4 campaigns to rotate, considering a default frequency cap of 15 minutes
39
- pub static ref IMPRESSION_STICKINESS_TIME : chrono:: Duration = chrono:: Duration :: milliseconds( 240000 ) ;
40
- }
36
+ /// Impression "stickiness" time: see https://github.com/AdExNetwork/adex-adview-manager/issues/65
37
+ /// 4 minutes allows ~4 campaigns to rotate, considering a default frequency cap of 15 minutes
38
+ pub static IMPRESSION_STICKINESS_TIME : Lazy < Duration > =
39
+ Lazy :: new ( || Duration :: milliseconds ( 240000 ) ) ;
41
40
42
41
#[ derive( Serialize , Deserialize ) ]
43
42
#[ serde( rename_all = "camelCase" ) ]
@@ -313,7 +312,7 @@ impl Manager {
313
312
. rev ( )
314
313
. find_map ( |h| {
315
314
if h. campaign_id == campaign_id {
316
- let last_impression: chrono :: Duration = Utc :: now ( ) - h. time ;
315
+ let last_impression: Duration = Utc :: now ( ) - h. time ;
317
316
318
317
u64:: try_from ( last_impression. num_seconds ( ) ) . ok ( )
319
318
} else {
0 commit comments