diff --git a/cache/cache_profiles.go b/cache/cache_profiles.go index 3bf5c51..b26be53 100644 --- a/cache/cache_profiles.go +++ b/cache/cache_profiles.go @@ -47,8 +47,8 @@ func (c *Cache) deleteProfile(data map[string]string) { _, ok1 := c.Profiles[data["profile_name"]] c.ProfilesMutex.Unlock() if !ok1 { - fmt.Println("Profile deleted") Database.Db.MustExec(Database.Db.Rebind("DELETE FROM urt_profiles WHERE name=?"), data["profile_name"]) + fmt.Println("Profile deleted") } else { fmt.Println("Something goes wrong! Profile is still here!") } diff --git a/requester/pooler.go b/requester/pooler.go index 8add1ef..8c12dcf 100644 --- a/requester/pooler.go +++ b/requester/pooler.go @@ -36,7 +36,7 @@ type Pooler struct { func (p *Pooler) Initialize() { fmt.Println("Initializing requester goroutine pooler...") // ToDo: figure out how to make this work nice. - p.maxrequests = 200 + p.maxrequests = 150 _ = runtime.GOMAXPROCS(runtime.NumCPU() * 4) p.pp = "\377\377\377\377" fmt.Println("Pooler initialized") diff --git a/timer/timer.go b/timer/timer.go index b176664..ca3b6a7 100644 --- a/timer/timer.go +++ b/timer/timer.go @@ -91,6 +91,7 @@ func (t *Timer) Initialize() { fmt.Println("Initializing timer...") t.initializeStorage() + Eventer.AddEventHandler("taskDone", t.SetTaskNotInProgress) ticker := time.NewTicker(time.Second * 1) go func() { @@ -98,8 +99,6 @@ func (t *Timer) Initialize() { go t.executeTasks() } }() - - Eventer.AddEventHandler("taskDone", t.SetTaskNotInProgress) } func (t *Timer) initializeStorage() { diff --git a/ui/gtk2/favorite.go b/ui/gtk2/favorite.go index 7597c8b..443b34e 100644 --- a/ui/gtk2/favorite.go +++ b/ui/gtk2/favorite.go @@ -18,6 +18,7 @@ import ( "strings" // Local + "github.com/pztrn/urtrator/cachemodels" "github.com/pztrn/urtrator/common" "github.com/pztrn/urtrator/datamodels" @@ -247,8 +248,17 @@ func (f *FavoriteDialog) saveFavorite() error { } fmt.Println("Saving favorite server...") + fmt.Println(fmt.Sprintf("%+v", f.server)) key := strings.Split(f.server_address.GetText(), ":")[0] + ":" + port + + // Check if server already in cache. This would replace data about it. + _, ok := ctx.Cache.Servers[key] + if !ok { + ctx.Cache.Servers[key] = &cachemodels.Server{} + ctx.Cache.Servers[key].Server = &datamodels.Server{} + } + ctx.Cache.Servers[key].Server.Ip = f.server.Ip ctx.Cache.Servers[key].Server.Port = f.server.Port ctx.Cache.Servers[key].Server.Name = f.server.Name