File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
packages/cubejs-server-core/src/core Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -128,15 +128,18 @@ export class OrchestratorApi {
128128 requestId : query . requestId
129129 } ) ;
130130
131+ if ( query . scheduledRefresh ) {
132+ throw {
133+ error : 'Continue wait' ,
134+ stage : null
135+ } ;
136+ }
137+
131138 const fromCache = await this
132139 . orchestrator
133140 . resultFromCacheIfExists ( query ) ;
134141
135- if (
136- ! query . renewQuery &&
137- fromCache &&
138- ! query . scheduledRefresh
139- ) {
142+ if ( query . cache === 'stale-if-slow' && fromCache ) {
140143 this . logger ( 'Slow Query Warning' , {
141144 query : queryForLog ,
142145 requestId : query . requestId ,
@@ -151,11 +154,17 @@ export class OrchestratorApi {
151154 } ;
152155 }
153156
157+ if ( query . cache === 'stale-while-revalidate' && fromCache ) {
158+ // TODO: Run background refresh
159+ return {
160+ ...fromCache ,
161+ slowQuery : true
162+ } ;
163+ }
164+
154165 throw {
155166 error : 'Continue wait' ,
156- stage : ! query . scheduledRefresh
157- ? await this . orchestrator . queryStage ( query )
158- : null
167+ stage : await this . orchestrator . queryStage ( query )
159168 } ;
160169 }
161170
You can’t perform that action at this time.
0 commit comments