mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
move DeleteZone to its own go routine -- crazy bug where we used the wrong DB conn
This commit is contained in:
parent
b7b813a4a7
commit
ab785aa992
@ -7,6 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/wavetermdev/thenextwave/pkg/filestore"
|
"github.com/wavetermdev/thenextwave/pkg/filestore"
|
||||||
"github.com/wavetermdev/thenextwave/pkg/waveobj"
|
"github.com/wavetermdev/thenextwave/pkg/waveobj"
|
||||||
@ -179,10 +180,16 @@ func DBDelete(ctx context.Context, otype string, id string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = filestore.WFS.DeleteZone(ctx, id)
|
go func() {
|
||||||
if err != nil {
|
// we spawn a go routine here because we don't want to reuse the DB connection
|
||||||
log.Printf("error deleting filestore zone (after deleting block): %v", err)
|
// since DBDelete is called in a transaction from DeleteTab
|
||||||
}
|
deleteCtx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
|
defer cancelFn()
|
||||||
|
err := filestore.WFS.DeleteZone(deleteCtx, id)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("error deleting filestore zone (after deleting block): %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user