Convert config.go into command line params

This commit is contained in:
Las Zenow 2016-05-03 01:03:23 -04:00
parent 9d1f1ad5c0
commit 0e8f1e7b56
14 changed files with 217 additions and 189 deletions

View file

@ -15,8 +15,12 @@ import (
"gitlab.com/trantor/trantor/lib/storage"
)
const (
uploadChanSize = 100
)
func InitUpload(database *database.DB, store *storage.Store) {
uploadChannel = make(chan uploadRequest, CHAN_SIZE)
uploadChannel = make(chan uploadRequest, uploadChanSize)
go uploadWorker(database, store)
}
@ -52,7 +56,7 @@ func processFile(req uploadRequest, db *database.DB, store *storage.Store) {
metadata["cover"] = GetCover(epub, id, store)
req.file.Seek(0, 0)
size, err := store.Store(id, req.file, EPUB_FILE)
size, err := store.Store(id, req.file, epubFile)
if err != nil {
log.Error("Error storing book (", id, "): ", err)
return
@ -98,7 +102,7 @@ func uploadHandler(h handler) {
data.S = GetStatus(h)
data.S.Title = "Upload -- " + data.S.Title
data.S.Upload = true
loadTemplate(h, "upload", data)
h.template.load(h, "upload", data)
}
type uploadData struct {