mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-26 10:23:28 +08:00
Go: add context (#17314)
### Summary As title. --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -309,7 +309,7 @@ func (h *Handler) DeleteUser(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
result, err := h.service.DeleteUser(username)
|
||||
result, err := h.service.DeleteUser(c.Request.Context(), username)
|
||||
if err != nil {
|
||||
common.ErrorWithCode(c, common.CodeServerError, err.Error())
|
||||
return
|
||||
|
||||
@@ -494,7 +494,7 @@ type DeleteUserResult struct {
|
||||
// Returns:
|
||||
// - *DeleteUserResult
|
||||
// - error: error message
|
||||
func (s *Service) DeleteUser(username string) (*DeleteUserResult, error) {
|
||||
func (s *Service) DeleteUser(ctx context.Context, username string) (*DeleteUserResult, error) {
|
||||
result := &DeleteUserResult{
|
||||
Username: username,
|
||||
DeletedDetails: []string{fmt.Sprintf("Drop user: %s", username)},
|
||||
@@ -559,7 +559,7 @@ func (s *Service) DeleteUser(username string) (*DeleteUserResult, error) {
|
||||
|
||||
if len(kbIDs) > 0 {
|
||||
// 2. Get document IDs
|
||||
docIDs, err := s.documentDAO.GetAllDocIDsByKBIDs(kbIDs)
|
||||
docIDs, err := s.documentDAO.GetAllDocIDsByKBIDs(ctx, tx, kbIDs)
|
||||
if err != nil {
|
||||
common.Warn("failed to get document IDs", zap.Error(err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user