From 1e72579ac7d9dfb4968e8025cd8c715feeecbb5e Mon Sep 17 00:00:00 2001 From: SmsS4 <36403983+SmsS4@users.noreply.github.com> Date: Sat, 19 Aug 2023 17:00:18 +0330 Subject: [PATCH] Fix s3.clean.uploads (#4766) --- weed/shell/command_s3_clean_uploads.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/weed/shell/command_s3_clean_uploads.go b/weed/shell/command_s3_clean_uploads.go index 81af4bbb7..2be61f72a 100644 --- a/weed/shell/command_s3_clean_uploads.go +++ b/weed/shell/command_s3_clean_uploads.go @@ -3,13 +3,14 @@ package shell import ( "flag" "fmt" - "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" - "github.com/seaweedfs/seaweedfs/weed/security" - "github.com/seaweedfs/seaweedfs/weed/util" "io" "math" "time" + "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" + "github.com/seaweedfs/seaweedfs/weed/security" + "github.com/seaweedfs/seaweedfs/weed/util" + "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" ) @@ -17,8 +18,7 @@ func init() { Commands = append(Commands, &commandS3CleanUploads{}) } -type commandS3CleanUploads struct { -} +type commandS3CleanUploads struct{} func (c *commandS3CleanUploads) Name() string { return "s3.clean.uploads" @@ -34,14 +34,13 @@ func (c *commandS3CleanUploads) Help() string { } func (c *commandS3CleanUploads) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) { - bucketCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError) uploadedTimeAgo := bucketCommand.Duration("timeAgo", 24*time.Hour, "created time before now. \"1.5h\" or \"2h45m\". Valid time units are \"m\", \"h\"") if err = bucketCommand.Parse(args); err != nil { return nil } - signingKey := util.GetViper().GetString("jwt.signing.key") + signingKey := util.GetViper().GetString("jwt.filer_signing.key") var filerBucketsPath string filerBucketsPath, err = readFilerBucketsPath(commandEnv) @@ -65,7 +64,6 @@ func (c *commandS3CleanUploads) Do(args []string, commandEnv *CommandEnv, writer } return err - } func (c *commandS3CleanUploads) cleanupUploads(commandEnv *CommandEnv, writer io.Writer, filerBucketsPath string, bucket string, timeAgo time.Duration, signingKey string) error { @@ -99,5 +97,4 @@ func (c *commandS3CleanUploads) cleanupUploads(commandEnv *CommandEnv, writer io } return nil - }