File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -209,8 +209,18 @@ func ViewPost(ctx *context_module.Context) {
209
209
step := steps [cursor .Step ]
210
210
211
211
logLines := make ([]* ViewStepLogLine , 0 ) // marshal to '[]' instead fo 'null' in json
212
- if c := cursor .Cursor ; c < step .LogLength && c >= 0 {
213
- index := step .LogIndex + c
212
+
213
+ index := step .LogIndex + cursor .Cursor
214
+ validCursor := cursor .Cursor >= 0 &&
215
+ // !(cursor.Cursor < step.LogLength) when the frontend tries to fetch next line before it's ready.
216
+ // So return the same cursor and empty lines to let the frontend retry.
217
+ cursor .Cursor < step .LogLength &&
218
+ // !(index < task.LogIndexes[index]) when task data is older than step data.
219
+ // It can be fixed by making sure write/read tasks and steps in the same transaction,
220
+ // but it's easier to just treat it as fetching the next line before it's ready.
221
+ index < int64 (len (task .LogIndexes ))
222
+
223
+ if validCursor {
214
224
length := step .LogLength - cursor .Cursor
215
225
offset := task .LogIndexes [index ]
216
226
var err error
You can’t perform that action at this time.
0 commit comments