fix(storage-users): keep uploads sessions CLI out of the dcfs event queue

The uploads sessions command builds a posix driver with async file
uploads enabled, which makes it join the "dcfs" JetStream queue group.
Clean/restart/resume events published by the command itself can then be
routed to the CLI's own short-lived consumer; the nats client auto-acks
them and they are lost when the process exits, leaving stale upload
sessions behind.

Disable asyncfileuploads for the CLI driver instance so it only lists
sessions and publishes events. Also emit [] instead of null when the
session list is empty so the JSON output stays parseable.
This commit is contained in:
Jörn Friedrich Dreyer committed 2026-09-25 15:47:47 +02:00
1 parent f7e6d5d0dd
commit 04ad5b84bb
1 file changed
+10 -5
+10 -5
View File
@@ -75,7 +75,14 @@ func ListUploadSessions(cfg *config.Config) *cobra.Command {
var fsStream events.Stream
if cfg.Driver == "posix" {
// We need to init the posix driver with 'scanfs' disabled
drivers["posix"] = revaconfig.Posix(cfg, false, false)
posixDrivers := revaconfig.Posix(cfg, false, false)
// Disable async file uploads: this command only lists sessions and publishes
// events, but with async uploads enabled the driver would join the "dcfs"
// JetStream queue group. Events routed to this short-lived CLI member are
// auto-acked by the nats client and lost when the process exits, so the
// clean/restart/resume events published below would never reach the daemon.
posixDrivers["asyncfileuploads"] = false
drivers["posix"] = posixDrivers
// Also posix refuses to start without an events stream
fsStream, err = event.NewStream(cfg)
if err != nil {
@@ -116,10 +123,8 @@ func ListUploadSessions(cfg *config.Config) *cobra.Command {
return err
}
var (
table *tablewriter.Table
raw []*Session
)
var table *tablewriter.Table
raw := []*Session{}
if !renderJson {
fmt.Println(buildInfo(filter))