mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-09-10 20:22:14 +02:00
parent
78fdbaf186
commit
27a569609c
1 changed files with 12 additions and 2 deletions
|
@ -209,8 +209,18 @@ func ViewPost(ctx *context_module.Context) {
|
||||||
step := steps[cursor.Step]
|
step := steps[cursor.Step]
|
||||||
|
|
||||||
logLines := make([]*ViewStepLogLine, 0) // marshal to '[]' instead fo 'null' in json
|
logLines := make([]*ViewStepLogLine, 0) // marshal to '[]' instead fo 'null' in json
|
||||||
if c := cursor.Cursor; c < step.LogLength && c >= 0 {
|
|
||||||
index := step.LogIndex + c
|
index := step.LogIndex + cursor.Cursor
|
||||||
|
validCursor := cursor.Cursor >= 0 &&
|
||||||
|
// !(cursor.Cursor < step.LogLength) when the frontend tries to fetch next line before it's ready.
|
||||||
|
// So return the same cursor and empty lines to let the frontend retry.
|
||||||
|
cursor.Cursor < step.LogLength &&
|
||||||
|
// !(index < task.LogIndexes[index]) when task data is older than step data.
|
||||||
|
// It can be fixed by making sure write/read tasks and steps in the same transaction,
|
||||||
|
// but it's easier to just treat it as fetching the next line before it's ready.
|
||||||
|
index < int64(len(task.LogIndexes))
|
||||||
|
|
||||||
|
if validCursor {
|
||||||
length := step.LogLength - cursor.Cursor
|
length := step.LogLength - cursor.Cursor
|
||||||
offset := task.LogIndexes[index]
|
offset := task.LogIndexes[index]
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Reference in a new issue