Reverting moving LockOSThread to main module.
This commit is contained in:
4
cache/cache_profiles.go
vendored
4
cache/cache_profiles.go
vendored
@@ -40,7 +40,9 @@ func (c *Cache) deleteProfile(data map[string]string) {
|
||||
_, ok1 := c.Profiles[data["profile_name"]]
|
||||
if !ok1 {
|
||||
fmt.Println("Profile deleted")
|
||||
Database.Unlock()
|
||||
Database.Db.MustExec(Database.Db.Rebind("DELETE FROM urt_profiles WHERE name=?"), data["profile_name"])
|
||||
Database.Lock()
|
||||
} else {
|
||||
fmt.Println("Something goes wrong! Profile is still here!")
|
||||
}
|
||||
@@ -75,6 +77,7 @@ func (c *Cache) FlushProfiles(data map[string]string) {
|
||||
}
|
||||
}
|
||||
|
||||
Database.Unlock()
|
||||
tx := Database.Db.MustBegin()
|
||||
fmt.Println("Adding new profiles...")
|
||||
for _, profile := range new_profiles {
|
||||
@@ -85,6 +88,7 @@ func (c *Cache) FlushProfiles(data map[string]string) {
|
||||
tx.NamedExec("UPDATE urt_profiles SET name=:name, version=:version, binary=:binary, second_x_session=:second_x_session, additional_parameters=:additional_parameters WHERE name=:name", &profile)
|
||||
}
|
||||
tx.Commit()
|
||||
Database.Lock()
|
||||
fmt.Println("Done")
|
||||
}
|
||||
|
||||
|
||||
2
cache/cache_servers.go
vendored
2
cache/cache_servers.go
vendored
@@ -85,6 +85,7 @@ func (c *Cache) FlushServers(data map[string]string) {
|
||||
}
|
||||
}
|
||||
|
||||
Database.Unlock()
|
||||
tx := Database.Db.MustBegin()
|
||||
fmt.Println("Adding new servers...")
|
||||
if len(new_servers) > 0 {
|
||||
@@ -101,6 +102,7 @@ func (c *Cache) FlushServers(data map[string]string) {
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
Database.Lock()
|
||||
fmt.Println("Done")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user