Skip to content

Commit

Permalink
txlog handle internal error #101
Browse files Browse the repository at this point in the history
  • Loading branch information
TanmoySG committed Apr 22, 2023
1 parent f69590e commit 6bc59a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/server/handlers/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ func (wh wdbHandlers) DeleteCollection(c *fiber.Ctx) error {
return err
}

go wh.handleTransactions(c, resp, entities)
go wh.handleTransactions(c, resp, entities)
return nil
}
14 changes: 8 additions & 6 deletions internal/server/handlers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ func validateRequest(request any) *er.WdbError {
}

func (wh wdbHandlers) handleTransactions(c *fiber.Ctx, apiResponse response.ApiResponse, entities model.Entities) {
var err error
if txlogs.IsTxnLoggable(apiResponse.Response.Action) {
if apiResponse.Response.Status == response.StatusSuccess {
databaseEntity := *entities.Databases
Expand All @@ -117,12 +116,15 @@ func (wh wdbHandlers) handleTransactions(c *fiber.Ctx, apiResponse response.ApiR
}

txnLog := txlogs.CreateTxLog(txnAction, txnActor, apiResponse.Response.Status, txnEntityPath, txnHttpDetails)
err = wh.wdbTxLogs.Log(txnLog)
err := wh.wdbTxLogs.Log(txnLog)
if err != nil {
log.Errorf("error logging transaction: %s", err)
}

err = wh.wdbTxLogs.Commit()

if err != nil {
log.Errorf("error logging transaction: %s", err)
}
}
}
if err != nil {
log.Errorf("error logging transaction: %s", err)
}
}

0 comments on commit 6bc59a6

Please sign in to comment.