File tree Expand file tree Collapse file tree 3 files changed +2
-5
lines changed
Expand file tree Collapse file tree 3 files changed +2
-5
lines changed Original file line number Diff line number Diff line change 11use std:: error:: Error ;
2+ use std:: future:: Future ;
23use std:: sync:: Arc ;
34use std:: time:: Instant ;
45
@@ -10,10 +11,9 @@ const CACHE_TTL_SECS: u64 = 120;
1011
1112pub type Cache < T > = State < Arc < RwLock < T > > > ;
1213
13- #[ async_trait]
1414pub trait Cached : Send + Sync + Clone + ' static {
1515 fn get_timestamp ( & self ) -> Instant ;
16- async fn fetch ( ) -> Result < Self , Box < dyn Error + Send + Sync > > ;
16+ fn fetch ( ) -> impl Future < Output = Result < Self , Box < dyn Error + Send + Sync > > > + Send ;
1717 async fn get ( cache : & Cache < Self > ) -> Self {
1818 let cached = cache. read ( ) . await . clone ( ) ;
1919 let timestamp = cached. get_timestamp ( ) ;
Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ impl Default for RustVersion {
4242 }
4343}
4444
45- #[ async_trait]
4645impl Cached for RustVersion {
4746 fn get_timestamp ( & self ) -> Instant {
4847 self . 1
@@ -68,7 +67,6 @@ impl Default for RustReleasePost {
6867 }
6968}
7069
71- #[ async_trait]
7270impl Cached for RustReleasePost {
7371 fn get_timestamp ( & self ) -> Instant {
7472 self . 1
Original file line number Diff line number Diff line change @@ -238,7 +238,6 @@ impl Default for RustTeams {
238238 }
239239}
240240
241- #[ async_trait]
242241impl Cached for RustTeams {
243242 fn get_timestamp ( & self ) -> Instant {
244243 self . 1
You can’t perform that action at this time.
0 commit comments