Browse Source

fmt-check

tags/vopendata0.1.2
palytoxin 5 years ago
parent
commit
cbdee6db32
3 changed files with 20 additions and 20 deletions
  1. +13
    -13
      models/attachment.go
  2. +3
    -3
      modules/timer/timer.go
  3. +4
    -4
      routers/repo/attachment.go

+ 13
- 13
models/attachment.go View File

@@ -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() {


+ 3
- 3
modules/timer/timer.go View File

@@ -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()
}
} ()
}()
}

+ 4
- 4
routers/repo/attachment.go View File

@@ -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())


Loading…
Cancel
Save