Skip to content

Commit

Permalink
Revert "Only track errored outcome in DB for asset resize"
Browse files Browse the repository at this point in the history
This reverts commit d7525f4.
  • Loading branch information
talal committed Mar 25, 2020
1 parent 7aae894 commit a9e13bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/api-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ The following additional fields may be returned:
| `pending_operation` | object | Information about an automated resize operation that is currently in progress. If there is no resize operation ongoing, this field will be omitted. |
| `finished_operations` | array of objects | Information about earlier automated resize operations. **This field is only shown on request** because it may be quite large. Add the query parameter `?history` to see it. |
| `finished_operations[].finished.at` | timestamp | When the operation entered its final state. |
| `finished_operations[].finished.error` | string | The backend error that caused this operation to fail. Only present when `state` is `errored`. |
| `finished_operations[].finished.error` | string | The backend error that caused this operation to fail. Only present when `state` is `failed` or `errored`. |

The following fields may be returned for each operation, both below `pending_operation` and below `finished_operations[]`:

Expand Down
6 changes: 1 addition & 5 deletions internal/tasks/asset_resize.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@ func (c Context) ExecuteNextResize() (targetAssetType db.AssetType, returnedErro
errorMessage := ""
if err != nil {
logg.Error("cannot resize %s %s to size %d: %s", string(res.AssetType), asset.UUID, op.NewSize, err.Error())

if outcome == db.OperationOutcomeErrored {
//We are only interested in tracking the status errored in the DB.
errorMessage = err.Error()
}
errorMessage = err.Error()
}

finishedOp := op.IntoFinishedOperation(outcome, c.TimeNow())
Expand Down
1 change: 1 addition & 0 deletions internal/tasks/asset_resize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func TestFailingResize(tBase *testing.T) {
GreenlitAt: p2time(c.TimeNow().Add(-5 * time.Minute)),
FinishedAt: c.TimeNow(),
Outcome: db.OperationOutcomeFailed,
ErrorMessage: "SetAssetSize failing as requested",
})

//check that asset does not have an ExpectedSize
Expand Down

0 comments on commit a9e13bc

Please sign in to comment.