File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -116,18 +116,8 @@ pub fn init_operator(cfg: &StorageParams) -> Result<Operator> {
116
116
/// Please balance the performance and compile time.
117
117
pub fn build_operator < B : Builder > ( builder : B ) -> Result < Operator > {
118
118
let ob = Operator :: new ( builder) ?
119
- // NOTE
120
- //
121
- // Magic happens here. We will add a layer upon original
122
- // storage operator so that all underlying storage operations
123
- // will send to storage runtime.
124
- . layer ( RuntimeLayer :: new ( GlobalIORuntime :: instance ( ) ) )
125
- . finish ( ) ;
126
-
127
- // Make sure the http client has been updated.
128
- ob. update_http_client ( |_| HttpClient :: with ( StorageHttpClient :: default ( ) ) ) ;
129
-
130
- let mut op = ob
119
+ // Timeout layer is required to be the first layer so that internal
120
+ // futures can be cancelled safely when the timeout is reached.
131
121
. layer ( {
132
122
let retry_timeout = env:: var ( "_DATABEND_INTERNAL_RETRY_TIMEOUT" )
133
123
. ok ( )
@@ -153,6 +143,18 @@ pub fn build_operator<B: Builder>(builder: B) -> Result<Operator> {
153
143
154
144
timeout_layer
155
145
} )
146
+ // NOTE
147
+ //
148
+ // Magic happens here. We will add a layer upon original
149
+ // storage operator so that all underlying storage operations
150
+ // will send to storage runtime.
151
+ . layer ( RuntimeLayer :: new ( GlobalIORuntime :: instance ( ) ) )
152
+ . finish ( ) ;
153
+
154
+ // Make sure the http client has been updated.
155
+ ob. update_http_client ( |_| HttpClient :: with ( StorageHttpClient :: default ( ) ) ) ;
156
+
157
+ let mut op = ob
156
158
// Add retry
157
159
. layer (
158
160
RetryLayer :: new ( )
You can’t perform that action at this time.
0 commit comments