Compare commits
5 Commits
v0.12.2
...
refactor-a
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dd166e65e | |||
| 9f7090a2f8 | |||
| 1bf557c3eb | |||
| df0c6d090d | |||
| b851a4f773 |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
github: tardisx
|
||||||
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v0.12.3] - 2022-05-09
|
||||||
|
|
||||||
|
- Fix a race condition occasionally causing multiple duplicate uploads
|
||||||
|
|
||||||
## [v0.12.2] - 2022-05-01
|
## [v0.12.2] - 2022-05-01
|
||||||
|
|
||||||
- Automatically open your web browser to the `dau` web interface
|
- Automatically open your web browser to the `dau` web interface
|
||||||
|
|||||||
1
dau.go
1
dau.go
@@ -129,6 +129,7 @@ func (w *watch) ProcessNewFiles() []string {
|
|||||||
}
|
}
|
||||||
w.lastCheck = w.newLastCheck
|
w.lastCheck = w.newLastCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
return newFiles
|
return newFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ type HTTPClient interface {
|
|||||||
|
|
||||||
type Uploader struct {
|
type Uploader struct {
|
||||||
Uploads []*Upload `json:"uploads"`
|
Uploads []*Upload `json:"uploads"`
|
||||||
|
Lock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
type Upload struct {
|
type Upload struct {
|
||||||
@@ -76,6 +78,7 @@ func NewUploader() *Uploader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *Uploader) AddFile(file string, conf config.Watcher) {
|
func (u *Uploader) AddFile(file string, conf config.Watcher) {
|
||||||
|
u.Lock.Lock()
|
||||||
atomic.AddInt32(¤tId, 1)
|
atomic.AddInt32(¤tId, 1)
|
||||||
thisUpload := Upload{
|
thisUpload := Upload{
|
||||||
Id: currentId,
|
Id: currentId,
|
||||||
@@ -91,19 +94,27 @@ func (u *Uploader) AddFile(file string, conf config.Watcher) {
|
|||||||
thisUpload.State = StatePending
|
thisUpload.State = StatePending
|
||||||
}
|
}
|
||||||
u.Uploads = append(u.Uploads, &thisUpload)
|
u.Uploads = append(u.Uploads, &thisUpload)
|
||||||
|
u.Lock.Unlock()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upload uploads any files that have not yet been uploaded
|
// Upload uploads any files that have not yet been uploaded
|
||||||
func (u *Uploader) Upload() {
|
func (u *Uploader) Upload() {
|
||||||
|
u.Lock.Lock()
|
||||||
|
|
||||||
for _, upload := range u.Uploads {
|
for _, upload := range u.Uploads {
|
||||||
if upload.State == StateQueued {
|
if upload.State == StateQueued {
|
||||||
upload.processUpload()
|
upload.processUpload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
u.Lock.Unlock()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Uploader) UploadById(id int32) *Upload {
|
func (u *Uploader) UploadById(id int32) *Upload {
|
||||||
|
u.Lock.Lock()
|
||||||
|
defer u.Lock.Unlock()
|
||||||
|
|
||||||
for _, anUpload := range u.Uploads {
|
for _, anUpload := range u.Uploads {
|
||||||
if anUpload.Id == int32(id) {
|
if anUpload.Id == int32(id) {
|
||||||
return anUpload
|
return anUpload
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"golang.org/x/mod/semver"
|
"golang.org/x/mod/semver"
|
||||||
)
|
)
|
||||||
|
|
||||||
const CurrentVersion string = "v0.12.2"
|
const CurrentVersion string = "v0.12.3"
|
||||||
|
|
||||||
type GithubRelease struct {
|
type GithubRelease struct {
|
||||||
HTMLURL string `json:"html_url"`
|
HTMLURL string `json:"html_url"`
|
||||||
|
|||||||
Reference in New Issue
Block a user