@@ -175,7 +175,7 @@ func (q *Querier) run(wg *sync.WaitGroup, timeBound *bucketState) {
175
175
// If timeBound is not nil, both the "absolute" and "current" blocks will run;
176
176
// otherwise, only the "current" block will execute. This execution pattern is used
177
177
// because if Downloaded block data is present, both the head block and downloaded block
178
- // need to be processed.
178
+ // need to be processed consecutively .
179
179
runBlockMode := "current"
180
180
for _ , query := range q .queries {
181
181
if runBlockMode == "current" {
@@ -211,20 +211,24 @@ func (q *Querier) query(expr string, timeMode string, timeBound *bucketState) {
211
211
qParams := req .URL .Query ()
212
212
qParams .Set ("query" , expr )
213
213
if q .qtype == "range" {
214
+ // here query is for current block i.e headblock and its range query.
214
215
if timeMode == "current" {
215
216
qParams .Set ("start" , fmt .Sprintf ("%d" , int64 (time .Now ().Add (- q .start ).Unix ())))
216
217
qParams .Set ("end" , fmt .Sprintf ("%d" , int64 (time .Now ().Add (- q .end ).Unix ())))
217
218
qParams .Set ("step" , q .step )
218
219
} else {
220
+ // here query is for downloaded block and its range query.
219
221
endTime := time .Unix (0 , timeBound .bucketConfig .MaxTime * int64 (time .Millisecond ))
220
222
qParams .Set ("start" , fmt .Sprintf ("%d" , int64 (endTime .Add (- q .start ).Unix ())))
221
223
qParams .Set ("end" , fmt .Sprintf ("%d" , int64 (endTime .Add (- q .end ).Unix ())))
222
224
qParams .Set ("step" , q .step )
223
225
}
224
226
} else if timeMode == "absolute" {
227
+ // here query is for downloaded block and its instant query.
225
228
blockinstime := time .Unix (0 , timeBound .bucketConfig .MaxTime * int64 (time .Millisecond ))
226
229
qParams .Set ("time" , fmt .Sprintf ("%d" , int64 (blockinstime .Unix ())))
227
230
}
231
+ // here query is for current block and its instant query i.e no need to specify the instant time.
228
232
req .URL .RawQuery = qParams .Encode ()
229
233
230
234
resp , err := http .DefaultClient .Do (req )
0 commit comments