From d15bb9752a9ac635eda4d0d1dca5b65ea90ced8e Mon Sep 17 00:00:00 2001 From: deranjer Date: Sun, 27 May 2018 17:34:14 -0400 Subject: [PATCH] Finished Engine re-write, awaiting testing --- engine/engine.go | 77 ++++++++++++++++------------- engine/engineHelpers.go | 41 +++++++++------ goTorrentWebUI/src/store/reducer.js | 6 +-- main.go | 42 ++++++++++++---- public/static/js/bundle.js | 4 +- 5 files changed, 107 insertions(+), 63 deletions(-) diff --git a/engine/engine.go b/engine/engine.go index 3fa126d6..7d076dee 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -169,7 +169,7 @@ func AddTorrent(clientTorrent *torrent.Torrent, torrentLocalStorage Storage.Torr } torrentLocalStorage.TorrentFile = torrentfile //storing the entire file in to database } - Logger.WithFields(logrus.Fields{"Storage Path": torrentStoragePath, "Torrent Name": clientTorrent.Name()}).Info("Adding Torrent with following storage path") + Logger.WithFields(logrus.Fields{"Storage Path": torrentStoragePath, "Torrent Name": clientTorrent.Name()}).Info("Adding Torrent with following storage path, to active Queue") torrentFiles := clientTorrent.Files() //storing all of the files in the database along with the priority var TorrentFilePriorityArray = []Storage.TorrentFilePriority{} for _, singleFile := range torrentFiles { //creating the database setup for the file array @@ -181,22 +181,15 @@ func AddTorrent(clientTorrent *torrent.Torrent, torrentLocalStorage Storage.Torr } torrentLocalStorage.TorrentFilePriority = TorrentFilePriorityArray - torrentQueues := Storage.FetchQueues(db) - if len(torrentQueues.ActiveTorrents) < Config.MaxActiveTorrents { - AddTorrentToActive(&torrentLocalStorage, clientTorrent, db) - fmt.Println("Adding New torrent to active! ", clientTorrent.Name()) - } else { - AddTorrentToQueue(&torrentLocalStorage, clientTorrent, db) - fmt.Println("Adding New torrent to queued! ", clientTorrent.Name()) - } + //torrentQueues := Storage.FetchQueues(db) + AddTorrentToActive(&torrentLocalStorage, clientTorrent, db) Storage.AddTorrentLocalStorage(db, torrentLocalStorage) //writing all of the data to the database } //CreateInitialTorrentArray adds all the torrents on program start from the database func CreateInitialTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Storage.TorrentLocal, db *storm.DB, config Settings.FullClientSettings) { for _, singleTorrentFromStorage := range TorrentLocalArray { - torrentQueues := Storage.FetchQueues(db) - fmt.Println("Stored Queues From DB.............................", torrentQueues) + var singleTorrent *torrent.Torrent var err error if singleTorrentFromStorage.TorrentType == "file" { //if it is a file pull it from the uploaded torrent folder @@ -225,47 +218,63 @@ func CreateInitialTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Sto if err != nil { Logger.WithFields(logrus.Fields{"torrentFile": singleTorrent.Name(), "error": err}).Error("Unable to add infobytes to the torrent!") } - fmt.Println("Creating initial FOR: ", singleTorrentFromStorage.Hash, singleTorrentFromStorage.TorrentName) - if len(torrentQueues.ActiveTorrents) < Config.MaxActiveTorrents && singleTorrentFromStorage.TorrentStatus != "Stopped" { - if singleTorrentFromStorage.TorrentStatus == "Completed" || singleTorrentFromStorage.TorrentStatus == "Seeding" { - fmt.Println("Completed Torrents have lower prio.. adding to Queued ", singleTorrent.Name()) + torrentQueues := Storage.FetchQueues(db) + if len(torrentQueues.ActiveTorrents) == 0 && len(torrentQueues.QueuedTorrents) == 0 { // If empty, run through all the torrents and assign them + if len(torrentQueues.ActiveTorrents) < Config.MaxActiveTorrents && singleTorrentFromStorage.TorrentStatus != "Stopped" { + if singleTorrentFromStorage.TorrentStatus == "Completed" || singleTorrentFromStorage.TorrentStatus == "Seeding" { + Logger.WithFields(logrus.Fields{"Torrent Name": singleTorrentFromStorage.TorrentName}).Info("Completed Torrents have lower priority, adding to Queued") + AddTorrentToQueue(singleTorrentFromStorage, singleTorrent, db) + } else { + Logger.WithFields(logrus.Fields{"Torrent Name": singleTorrentFromStorage.TorrentName}).Info("Adding Torrent to Active Queue") + AddTorrentToActive(singleTorrentFromStorage, singleTorrent, db) + } + } else { + Logger.WithFields(logrus.Fields{"Torrent Name": singleTorrentFromStorage.TorrentName}).Info("Last resort for torrent, adding to Queued") + AddTorrentToQueue(singleTorrentFromStorage, singleTorrent, db) + } + } else { //If we already have a queue set up then assign torrents to queue + Logger.Info("Existing Queue found in database, reading it in") + if singleTorrentFromStorage.TorrentStatus == "Queued" { AddTorrentToQueue(singleTorrentFromStorage, singleTorrent, db) } else { - fmt.Println("adding torrent to active NOW ", singleTorrent.Name()) - AddTorrentToActive(singleTorrentFromStorage, singleTorrent, db) + if len(torrentQueues.ActiveTorrents) < Config.MaxActiveTorrents && singleTorrentFromStorage.TorrentStatus != "Stopped" { + AddTorrentToActive(singleTorrentFromStorage, singleTorrent, db) + } else { + AddTorrentToQueue(singleTorrentFromStorage, singleTorrent, db) + } } - } else { - fmt.Println("adding torrent to queued NOW ", singleTorrent.Name()) - AddTorrentToQueue(singleTorrentFromStorage, singleTorrent, db) + RemoveDuplicatesFromQueues(db) } - //Storage.UpdateQueues(db, torrentQueues) Storage.UpdateStorageTick(db, *singleTorrentFromStorage) } torrentQueues := Storage.FetchQueues(db) if len(torrentQueues.ActiveTorrents) < config.MaxActiveTorrents && len(torrentQueues.QueuedTorrents) > 0 { //after all the torrents are added, see if out active torrent list isn't full, then add from the queue - fmt.Println("adding torrents from queue (if any in there)", "MaX: ", config.MaxActiveTorrents, "Current: ", torrentQueues.ActiveTorrents) + Logger.WithFields(logrus.Fields{"Max Active: ": config.MaxActiveTorrents, "Current : ": torrentQueues.ActiveTorrents}).Debug("Adding Torrents from queue to active to fill...") maxCanSend := config.MaxActiveTorrents - len(torrentQueues.ActiveTorrents) + if maxCanSend > len(torrentQueues.QueuedTorrents) { + maxCanSend = len(torrentQueues.QueuedTorrents) + } torrentsToStart := make([]string, maxCanSend) - for i, torrentHash := range torrentQueues.QueuedTorrents { - torrentsToStart[i] = torrentHash + copy(torrentsToStart, torrentQueues.QueuedTorrents[len(torrentsToStart)-1:]) + for _, torrentStart := range torrentsToStart { for _, singleTorrent := range tclient.Torrents() { - if singleTorrent.InfoHash().String() == torrentHash { - singleTorrentFromStorage := Storage.FetchTorrentFromStorage(db, torrentHash) + if singleTorrent.InfoHash().String() == torrentStart { + singleTorrentFromStorage := Storage.FetchTorrentFromStorage(db, torrentStart) AddTorrentToActive(&singleTorrentFromStorage, singleTorrent, db) } } - } } SetFilePriority(tclient, db) //Setting the desired file priority from storage - fmt.Println("Initial Setup queues", torrentQueues) + Logger.WithFields(logrus.Fields{"Max Active: ": config.MaxActiveTorrents, "Current : ": torrentQueues.ActiveTorrents}).Debug("Queue after all initial torrents have been added") } //CreateRunningTorrentArray creates the entire torrent list to pass to client func CreateRunningTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Storage.TorrentLocal, PreviousTorrentArray []ClientDB, config Settings.FullClientSettings, db *storm.DB) (RunningTorrentArray []ClientDB) { torrentQueues := Storage.FetchQueues(db) - fmt.Println("torrentQueues", torrentQueues) + Logger.WithFields(logrus.Fields{"Max Active: ": config.MaxActiveTorrents, "TorrentQueues": torrentQueues}).Debug("Current TorrentQueues") for _, singleTorrentFromStorage := range TorrentLocalArray { + torrentQueues := Storage.FetchQueues(db) var singleTorrent *torrent.Torrent var TempHash metainfo.Hash for _, liveTorrent := range tclient.Torrents() { //matching the torrent from storage to the live torrent @@ -311,11 +320,8 @@ func CreateRunningTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Sto Storage.UpdateStorageTick(db, tStorage) } }() - } - fullStruct := singleTorrent.Stats() - activePeersString := strconv.Itoa(fullStruct.ActivePeers) //converting to strings totalPeersString := fmt.Sprintf("%v", fullStruct.TotalPeers) fullClientDB.StoragePath = singleTorrentFromStorage.StoragePath @@ -350,7 +356,12 @@ func CreateRunningTorrentArray(tclient *torrent.Client, TorrentLocalArray []*Sto CalculateTorrentETA(singleTorrentFromStorage.TorrentSize, calculatedCompletedSize, fullClientDB) //needs to be here since we need the speed calculated before we can estimate the eta. if (len(torrentQueues.ActiveTorrents) < config.MaxActiveTorrents) && (len(torrentQueues.QueuedTorrents) > 0) { //If there is room for another torrent in active torrents, add it. - newTorrentHash := torrentQueues.QueuedTorrents[0] + var newTorrentHash string + for _, torrentHash := range torrentQueues.QueuedTorrents { + if singleTorrentFromStorage.TorrentStatus != "Stopped" { + newTorrentHash = torrentHash + } + } for _, torrent := range tclient.Torrents() { if newTorrentHash == torrent.InfoHash().String() { AddTorrentToActive(singleTorrentFromStorage, singleTorrent, db) diff --git a/engine/engineHelpers.go b/engine/engineHelpers.go index ef129314..db46308c 100644 --- a/engine/engineHelpers.go +++ b/engine/engineHelpers.go @@ -188,19 +188,22 @@ func CalculateUploadRatio(t *torrent.Torrent, c *ClientDB) string { func StopTorrent(singleTorrent *torrent.Torrent, torrentLocalStorage *Storage.TorrentLocal, db *storm.DB) { torrentQueues := Storage.FetchQueues(db) if torrentLocalStorage.TorrentStatus == "Stopped" { //if we are already stopped - fmt.Println("Already stopped, returning....") + Logger.WithFields(logrus.Fields{"Torrent Name": torrentLocalStorage.TorrentName}).Info("Torrent Already Stopped, returning...") return } torrentLocalStorage.TorrentStatus = "Stopped" torrentLocalStorage.MaxConnections = 0 singleTorrent.SetMaxEstablishedConns(0) - fmt.Println("Getting ready to stop....!!!!!!!!") for _, torrentHash := range torrentQueues.ActiveTorrents { //pulling it out of activetorrents if torrentHash == singleTorrent.InfoHash().String() { DeleteTorrentFromQueues(singleTorrent.InfoHash().String(), db) } } - fmt.Println("LOCALSTORAGE", *torrentLocalStorage, torrentLocalStorage) + for _, torrentHash := range torrentQueues.QueuedTorrents { //pulling it out of queuedTorrent + if torrentHash == singleTorrent.InfoHash().String() { + DeleteTorrentFromQueues(singleTorrent.InfoHash().String(), db) + } + } Storage.UpdateStorageTick(db, *torrentLocalStorage) CreateServerPushMessage(ServerPushMessage{MessageType: "serverPushMessage", MessageLevel: "success", Payload: "Torrent Stopped!"}, Conn) return @@ -224,7 +227,6 @@ func AddTorrentToActive(torrentLocalStorage *Storage.TorrentLocal, singleTorrent torrentQueues.ActiveTorrents = append(torrentQueues.ActiveTorrents, singleTorrent.InfoHash().String()) torrentLocalStorage.TorrentStatus = "Running" torrentLocalStorage.MaxConnections = 80 - Logger.WithFields(logrus.Fields{"torrentName": singleTorrent.Name()}).Info("Moving torrent to active, active slice contains ", len(torrentQueues.ActiveTorrents), " torrents: ", torrentQueues.ActiveTorrents) for _, file := range singleTorrent.Files() { for _, sentFile := range torrentLocalStorage.TorrentFilePriority { if file.DisplayPath() == sentFile.TorrentFilePath { @@ -241,7 +243,7 @@ func AddTorrentToActive(torrentLocalStorage *Storage.TorrentLocal, singleTorrent } } } - fmt.Println("Updating Queues from Add To active....", torrentQueues) + Logger.WithFields(logrus.Fields{"Torrent Name": torrentLocalStorage.TorrentName}).Info("Adding Torrent to Active Queue") Storage.UpdateQueues(db, torrentQueues) } @@ -256,7 +258,7 @@ func RemoveTorrentFromActive(torrentLocalStorage *Storage.TorrentLocal, singleTo torrentLocalStorage.MaxConnections = 0 singleTorrent.SetMaxEstablishedConns(0) Storage.UpdateQueues(db, torrentQueues) - AddTorrentToQueue(torrentLocalStorage, singleTorrent, db) //Adding the lasttorrent from active to queued + //AddTorrentToQueue(torrentLocalStorage, singleTorrent, db) //Adding the lasttorrent from active to queued Storage.UpdateStorageTick(db, *torrentLocalStorage) } } @@ -273,12 +275,13 @@ func DeleteTorrentFromQueues(torrentHash string, db *storm.DB) { } else { for x, torrentHashQueued := range torrentQueues.QueuedTorrents { if torrentHash == torrentHashQueued { - torrentQueues.ActiveTorrents = append(torrentQueues.QueuedTorrents[:x], torrentQueues.QueuedTorrents[x+1:]...) + torrentQueues.QueuedTorrents = append(torrentQueues.QueuedTorrents[:x], torrentQueues.QueuedTorrents[x+1:]...) Storage.UpdateQueues(db, torrentQueues) } } } } + Logger.WithFields(logrus.Fields{"Torrent Hash": torrentHash}).Info("Removing Torrent from all Queues") } //AddTorrentToQueue adds a torrent to the queue @@ -286,7 +289,6 @@ func AddTorrentToQueue(torrentLocalStorage *Storage.TorrentLocal, singleTorrent torrentQueues := Storage.FetchQueues(db) for _, torrentHash := range torrentQueues.QueuedTorrents { if singleTorrent.InfoHash().String() == torrentHash { //don't add duplicate to que but do everything else (TODO, maybe find a better way?) - fmt.Println("TORRENTQUEUES", torrentQueues) singleTorrent.SetMaxEstablishedConns(0) torrentLocalStorage.MaxConnections = 0 torrentLocalStorage.TorrentStatus = "Queued" @@ -296,7 +298,6 @@ func AddTorrentToQueue(torrentLocalStorage *Storage.TorrentLocal, singleTorrent } } torrentQueues.QueuedTorrents = append(torrentQueues.QueuedTorrents, singleTorrent.InfoHash().String()) - fmt.Println("TORRENTQUEUES", torrentQueues) singleTorrent.SetMaxEstablishedConns(0) torrentLocalStorage.MaxConnections = 0 torrentLocalStorage.TorrentStatus = "Queued" @@ -305,25 +306,37 @@ func AddTorrentToQueue(torrentLocalStorage *Storage.TorrentLocal, singleTorrent Storage.UpdateStorageTick(db, *torrentLocalStorage) } +//RemoveDuplicatesFromQueues removes any duplicates from torrentQueues.QueuedTorrents (which will happen if it is read in from DB) +func RemoveDuplicatesFromQueues(db *storm.DB) { + torrentQueues := Storage.FetchQueues(db) + for _, torrentHash := range torrentQueues.ActiveTorrents { + for i, queuedHash := range torrentQueues.QueuedTorrents { + if torrentHash == queuedHash { + torrentQueues.QueuedTorrents = append(torrentQueues.QueuedTorrents[:i], torrentQueues.QueuedTorrents[i+1:]...) + } + } + } + Storage.UpdateQueues(db, torrentQueues) +} + //CalculateTorrentStatus is used to determine what the STATUS column of the frontend will display ll2 func CalculateTorrentStatus(t *torrent.Torrent, c *ClientDB, config Settings.FullClientSettings, tFromStorage *storage.TorrentLocal, bytesCompleted int64, totalSize int64, torrentQueues Storage.TorrentQueues, db *storm.DB) { + if tFromStorage.TorrentStatus == "Stopped" { + c.Status = "Stopped" + return + } if float64(c.TotalUploadedBytes)/float64(bytesCompleted) >= config.SeedRatioStop && tFromStorage.TorrentUploadLimit == true { //If storage shows torrent stopped or if it is over the seeding ratio AND is under the global limit StopTorrent(t, tFromStorage, db) } else { //Only has 2 states in storage, stopped or running, so we know it should be running, and the websocket request handled updating the database with connections and status for _, torrentHash := range torrentQueues.QueuedTorrents { if tFromStorage.Hash == torrentHash { - //AddTorrentToQueue(tFromStorage, t, db) - //Logger.WithFields(logrus.Fields{"TorrentName": tFromStorage.TorrentName, "connections": tFromStorage.MaxConnections}).Info("Torrent is queued, skipping") - //t.SetMaxEstablishedConns(0) c.Status = "Queued" return } } if len(torrentQueues.ActiveTorrents) < config.MaxActiveTorrents && tFromStorage.TorrentStatus == "Queued" { - fmt.Println("HERE..............ADDDING TO ACTIVE", t.Name()) AddTorrentToActive(tFromStorage, t, db) - c.Status = "Downloading" } bytesMissing := totalSize - bytesCompleted c.MaxConnections = 80 diff --git a/goTorrentWebUI/src/store/reducer.js b/goTorrentWebUI/src/store/reducer.js index aec84387..94040e5c 100644 --- a/goTorrentWebUI/src/store/reducer.js +++ b/goTorrentWebUI/src/store/reducer.js @@ -151,10 +151,9 @@ const reducer = (state = initialState, action) => { selectedRows.push(state.torrentList[element]) //pushing the selected rows out of torrentlist }); - - let buttonStateTest = selectedRows.filter(element => { //TODO fix this bad mess... we literally just need to filter for stopped and go from there + let buttonStateTest = selectedRows.filter(element => { let result = [] - if (element.Status === "Downloading" || element.Status === "Awaiting Peers" || element.Status === "Seeding" || element.Status === "Completed"){ + if (element.Status === "Downloading" || element.Status === "Awaiting Peers" || element.Status === "Seeding" || element.Status === "Completed" || element.Status === "Queued"){ result.push(element.Status) return result } @@ -164,7 +163,6 @@ const reducer = (state = initialState, action) => { if (buttonStateTest.length > 0 && buttonStateTest2.length === 0){ let buttonStateFinal = [{startButton: "default", stopButton: "primary", deleteButton: "secondary", fSeedButton: "default", fRecheckButton: "primary"}] - console.log("ButtonStateFil") return { ...state, buttonState: buttonStateFinal diff --git a/main.go b/main.go index 5e5d6a8b..080c98b9 100644 --- a/main.go +++ b/main.go @@ -202,7 +202,6 @@ func main() { } else { Logger.Info("Database is empty, no torrents loaded") } - fmt.Println("HERE ACTIVE", torrentQueues.ActiveTorrents) Engine.CheckTorrentWatchFolder(cronEngine, db, tclient, torrentLocalStorage, Config, torrentQueues) //Every 5 minutes the engine will check the specified folder for new .torrent files Engine.RefreshRSSCron(cronEngine, db, tclient, torrentLocalStorage, Config, torrentQueues) // Refresing the RSS feeds on an hourly basis to add torrents that show up in the RSS feed @@ -432,8 +431,18 @@ func main() { } Logger.WithFields(logrus.Fields{"clientTorrent": clientTorrent, "magnetLink": magnetLink}).Info("Adding torrent to client!") Engine.CreateServerPushMessage(Engine.ServerPushMessage{MessageType: "serverPushMessage", MessageLevel: "info", Payload: "Received MagnetLink"}, conn) + if len(torrentQueues.ActiveTorrents) > Config.MaxActiveTorrents { + Logger.WithFields(logrus.Fields{"Name: ": clientTorrent.Name()}).Info("Adding New torrent to active, pushing other torrent to queue") + removeTorrent := torrentQueues.ActiveTorrents[:1] + for _, singleTorrent := range runningTorrents { + if singleTorrent.InfoHash().String() == removeTorrent[0] { + oldTorrentInfo := Storage.FetchTorrentFromStorage(db, singleTorrent.InfoHash().String()) + Engine.RemoveTorrentFromActive(&oldTorrentInfo, singleTorrent, db) + Storage.UpdateStorageTick(db, oldTorrentInfo) + } + } + } go Engine.AddTorrent(clientTorrent, torrentLocalStorage, db, "magnet", "", storageValue, labelValue, Config) //starting the torrent and creating local DB entry - } case "torrentFileSubmit": @@ -479,7 +488,18 @@ func main() { Engine.CreateServerPushMessage(Engine.ServerPushMessage{MessageType: "serverPushMessage", MessageLevel: "error", Payload: "Unable to add Torrent to torrent server"}, conn) } Logger.WithFields(logrus.Fields{"clienttorrent": clientTorrent.Name(), "filename": filePathAbs}).Info("Added torrent") - go Engine.AddTorrent(clientTorrent, torrentLocalStorage, db, "file", filePathAbs, storageValue, labelValue, Config) + if len(torrentQueues.ActiveTorrents) >= Config.MaxActiveTorrents { + Logger.WithFields(logrus.Fields{"Name: ": clientTorrent.Name()}).Info("Adding New torrent to active, pushing other torrent to queue") + removeTorrent := torrentQueues.ActiveTorrents[:1] + for _, singleTorrent := range runningTorrents { + if singleTorrent.InfoHash().String() == removeTorrent[0] { + oldTorrentInfo := Storage.FetchTorrentFromStorage(db, singleTorrent.InfoHash().String()) + Engine.RemoveTorrentFromActive(&oldTorrentInfo, singleTorrent, db) + Storage.UpdateStorageTick(db, oldTorrentInfo) + go Engine.AddTorrent(clientTorrent, torrentLocalStorage, db, "file", filePathAbs, storageValue, labelValue, Config) + } + } + } case "stopTorrents": torrentHashes := payloadData["TorrentHashes"].([]interface{}) @@ -487,13 +507,18 @@ func main() { for _, singleTorrent := range tclient.Torrents() { for _, singleSelection := range torrentHashes { if singleTorrent.InfoHash().String() == singleSelection { - fmt.Println("Hash", singleTorrent.InfoHash().String(), "otherhash", singleSelection) Logger.WithFields(logrus.Fields{"selection": singleSelection}).Info("Matched for stopping torrents") oldTorrentInfo := Storage.FetchTorrentFromStorage(db, singleTorrent.InfoHash().String()) Engine.StopTorrent(singleTorrent, &oldTorrentInfo, db) - fmt.Println("Getting ready to write to storage", oldTorrentInfo.Hash, oldTorrentInfo.TorrentStatus) - //Storage.UpdateStorageTick(db, oldTorrentInfo) //Updating the torrent status - continue + if len(torrentQueues.QueuedTorrents) > 1 { + addTorrent := torrentQueues.QueuedTorrents[:1] + for _, singleTorrent := range runningTorrents { + if singleTorrent.InfoHash().String() == addTorrent[0] { + Engine.AddTorrentToActive(&torrentLocalStorage, singleTorrent, db) + } + } + } + } } } @@ -544,7 +569,7 @@ func main() { oldTorrentInfo := Storage.FetchTorrentFromStorage(db, singleTorrent.InfoHash().String()) Engine.AddTorrentToActive(&oldTorrentInfo, singleTorrent, db) Logger.WithFields(logrus.Fields{"Torrent": oldTorrentInfo.TorrentName}).Info("Changing database to torrent running with 80 max connections") - //Storage.UpdateStorageTick(db, oldTorrentInfo) //Updating the torrent status + Storage.UpdateStorageTick(db, oldTorrentInfo) //Updating the torrent status } torrentQueues = Storage.FetchQueues(db) if len(torrentQueues.ActiveTorrents) > Config.MaxActiveTorrents { //Since we are starting a new torrent stop the first torrent in the que if running is full @@ -573,7 +598,6 @@ func main() { oldTorrentInfo.TorrentUploadLimit = false // no upload limit for this torrent oldTorrentInfo.TorrentStatus = "Running" oldTorrentInfo.MaxConnections = 80 - fmt.Println("OldtorrentinfoName", oldTorrentInfo.TorrentName) Logger.WithFields(logrus.Fields{"NewMax": oldTorrentInfo.MaxConnections, "Torrent": oldTorrentInfo.TorrentName}).Info("Setting max connection from zero to 80") Storage.UpdateStorageTick(db, oldTorrentInfo) //Updating the torrent status } diff --git a/public/static/js/bundle.js b/public/static/js/bundle.js index c391c32a..3107849c 100644 --- a/public/static/js/bundle.js +++ b/public/static/js/bundle.js @@ -80052,9 +80052,8 @@ var reducer = function reducer() { }); var buttonStateTest = selectedRows.filter(function (element) { - //TODO fix this bad mess... we literally just need to filter for stopped and go from there var result = []; - if (element.Status === "Downloading" || element.Status === "Awaiting Peers" || element.Status === "Seeding" || element.Status === "Completed") { + if (element.Status === "Downloading" || element.Status === "Awaiting Peers" || element.Status === "Seeding" || element.Status === "Completed" || element.Status === "Queued") { result.push(element.Status); return result; } @@ -80066,7 +80065,6 @@ var reducer = function reducer() { if (buttonStateTest.length > 0 && buttonStateTest2.length === 0) { var _buttonStateFinal2 = [{ startButton: "default", stopButton: "primary", deleteButton: "secondary", fSeedButton: "default", fRecheckButton: "primary" }]; - console.log("ButtonStateFil"); return _extends({}, state, { buttonState: _buttonStateFinal2 });