From cbdee6db324c196e5efa7ea9d6809bd8a855c994 Mon Sep 17 00:00:00 2001 From: palytoxin Date: Tue, 18 Aug 2020 18:15:34 +0800 Subject: [PATCH] fmt-check --- models/attachment.go | 26 +++++++++++++------------- modules/timer/timer.go | 6 +++--- routers/repo/attachment.go | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/models/attachment.go b/models/attachment.go index f6c706e4e..afb2bbe16 100755 --- a/models/attachment.go +++ b/models/attachment.go @@ -28,19 +28,19 @@ const ( // Attachment represent a attachment of issue/comment/release. type Attachment struct { - ID int64 `xorm:"pk autoincr"` - UUID string `xorm:"uuid UNIQUE"` - IssueID int64 `xorm:"INDEX"` - DatasetID int64 `xorm:"INDEX DEFAULT 0"` - ReleaseID int64 `xorm:"INDEX"` - UploaderID int64 `xorm:"INDEX DEFAULT 0"` // Notice: will be zero before this column added - CommentID int64 - Name string - DownloadCount int64 `xorm:"DEFAULT 0"` - Size int64 `xorm:"DEFAULT 0"` - IsPrivate bool `xorm:"DEFAULT false"` - DecompressState int32 `xorm:"DEFAULT 0"` - CreatedUnix timeutil.TimeStamp `xorm:"created"` + ID int64 `xorm:"pk autoincr"` + UUID string `xorm:"uuid UNIQUE"` + IssueID int64 `xorm:"INDEX"` + DatasetID int64 `xorm:"INDEX DEFAULT 0"` + ReleaseID int64 `xorm:"INDEX"` + UploaderID int64 `xorm:"INDEX DEFAULT 0"` // Notice: will be zero before this column added + CommentID int64 + Name string + DownloadCount int64 `xorm:"DEFAULT 0"` + Size int64 `xorm:"DEFAULT 0"` + IsPrivate bool `xorm:"DEFAULT false"` + DecompressState int32 `xorm:"DEFAULT 0"` + CreatedUnix timeutil.TimeStamp `xorm:"created"` } func (a *Attachment) AfterUpdate() { diff --git a/modules/timer/timer.go b/modules/timer/timer.go index f74bb3a11..0d47102c0 100755 --- a/modules/timer/timer.go +++ b/modules/timer/timer.go @@ -7,15 +7,15 @@ import ( ) const ( - DecompressTimer = time.Minute * 10 + DecompressTimer = time.Minute * 10 ) func init() { ticker := time.NewTicker(DecompressTimer) go func() { for { - <- ticker.C + <-ticker.C repo.HandleUnDecompressAttachment() } - } () + }() } diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index f40783bc2..5f69d70ba 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -24,8 +24,8 @@ import ( const ( //result of decompress - DecompressSuccess = "0" - DecompressFailed = "1" + DecompressSuccess = "0" + DecompressFailed = "1" ) func RenderAttachmentSettings(ctx *context.Context) { @@ -330,13 +330,13 @@ func UpdateAttachmentDecompressState(ctx *context.Context) { } func HandleUnDecompressAttachment() { - attachs,err := models.GetUnDecompressAttachments() + attachs, err := models.GetUnDecompressAttachments() if err != nil { log.Error("GetUnDecompressAttachments failed:", err.Error()) return } - for _,attach := range attachs { + for _, attach := range attachs { err = worker.SendDecompressTask(contexExt.Background(), attach.UUID) if err != nil { log.Error("SendDecompressTask(%s) failed:%s", attach.UUID, err.Error())