@@ -3,8 +3,7 @@ use pragma_entities::{
3
3
Entry , FundingRate , FutureEntry , InfraError , NewEntry , NewFundingRate , NewFutureEntry ,
4
4
} ;
5
5
use tokio:: sync:: mpsc;
6
- use tokio:: time:: { interval, Duration , Instant } ;
7
- use tracing:: { debug, info} ;
6
+ use tracing:: debug;
8
7
9
8
#[ tracing:: instrument( skip( pool, rx) ) ]
10
9
pub async fn process_spot_entries ( pool : Pool , mut rx : mpsc:: Receiver < NewEntry > ) {
@@ -40,7 +39,6 @@ pub async fn process_spot_entries(pool: Pool, mut rx: mpsc::Receiver<NewEntry>)
40
39
#[ tracing:: instrument( skip( pool, rx) ) ]
41
40
pub async fn process_future_entries ( pool : Pool , mut rx : mpsc:: Receiver < NewFutureEntry > ) {
42
41
const BUFFER_CAPACITY : usize = 100 ;
43
- const FLUSH_TIMEOUT : Duration = Duration :: from_millis ( 50 ) ;
44
42
45
43
let mut buffer = Vec :: with_capacity ( BUFFER_CAPACITY ) ;
46
44
@@ -102,25 +100,13 @@ pub async fn process_funding_rate_entries(pool: Pool, mut rx: mpsc::Receiver<New
102
100
103
101
#[ tracing:: instrument( skip_all, fields( num_entries = new_entries. len( ) ) ) ]
104
102
async fn insert_spot_entries ( pool : & Pool , new_entries : Vec < NewEntry > ) -> Result < ( ) , InfraError > {
105
- let start = Instant :: now ( ) ;
106
- let len = new_entries. len ( ) ;
107
103
let conn = pool. get ( ) . await . map_err ( InfraError :: DbPoolError ) ?;
108
104
let entries = conn
109
105
. interact ( move |conn| Entry :: create_many ( conn, new_entries) )
110
106
. await
111
107
. map_err ( InfraError :: DbInteractionError ) ?
112
108
. map_err ( InfraError :: DbResultError ) ?;
113
109
114
- let duration = start. elapsed ( ) ;
115
- info ! ( "insert_spot_entries took {:?} for {} entries" , duration, len) ;
116
-
117
- for entry in & entries {
118
- debug ! (
119
- "new spot entry created {} - {}({}) - {}" ,
120
- entry. publisher, entry. pair_id, entry. price, entry. source
121
- ) ;
122
- }
123
-
124
110
Ok ( ( ) )
125
111
}
126
112
@@ -151,17 +137,11 @@ async fn insert_future_entries(
151
137
. count( )
152
138
) ;
153
139
154
- let entries = conn
140
+ conn
155
141
. interact ( move |conn| FutureEntry :: create_many ( conn, new_entries) )
156
142
. await
157
143
. map_err ( InfraError :: DbInteractionError ) ?
158
144
. map_err ( InfraError :: DbResultError ) ?;
159
- for entry in & entries {
160
- debug ! (
161
- "new perp entry created {} - {}({}) - {}" ,
162
- entry. publisher, entry. pair_id, entry. price, entry. source
163
- ) ;
164
- }
165
145
Ok ( ( ) )
166
146
}
167
147
0 commit comments