feat: add kafka admin integration
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -349,6 +350,9 @@ func largeFileReceiveHTTP(wrt http.ResponseWriter, req *http.Request) {
|
||||
writeHttpResponse(decodeStoreError(err, msgID, now, nil), err)
|
||||
return
|
||||
}
|
||||
if err = enqueueKafkaFileUploaded(req.Context(), principal.TenantID, fdef); err != nil {
|
||||
logs.Warn.Printf("media upload: failed to enqueue file lifecycle event file=%s: %v", fdef.Id, err)
|
||||
}
|
||||
|
||||
params := map[string]string{"url": url}
|
||||
if globals.mediaGcPeriod > 0 {
|
||||
@@ -628,6 +632,15 @@ func (*grpcNodeServer) LargeFileReceive(stream pbx.Node_LargeFileReceiveServer)
|
||||
Size: size,
|
||||
},
|
||||
})
|
||||
if err == nil {
|
||||
if fdef, finishErr := store.Files.FinishUpload(principal.TenantID, fdef, true, size); finishErr == nil {
|
||||
if lifecycleErr := enqueueKafkaFileUploaded(context.Background(), principal.TenantID, fdef); lifecycleErr != nil {
|
||||
logs.Warn.Printf("media upload: failed to enqueue grpc file lifecycle event file=%s: %v", fdef.Id, lifecycleErr)
|
||||
}
|
||||
} else {
|
||||
err = finishErr
|
||||
}
|
||||
}
|
||||
logs.Info.Println("media upload: ok", fdef.Id, fdef.Location, err)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user