Fix leaking goroutines in store calls (#3993). (#4021)

Этот коммит содержится в:
Kyo Nguyen
2016-09-19 19:30:41 +07:00
коммит произвёл Joram Wilander
родитель 33eda94db3
Коммит 2ca751febf
16 изменённых файлов: 191 добавлений и 188 удалений

Просмотреть файл

@@ -4,9 +4,10 @@
package store
import (
"strings"
"github.com/go-gorp/gorp"
"github.com/mattermost/platform/model"
"strings"
)
type SqlOAuthStore struct {
@@ -57,7 +58,7 @@ func (as SqlOAuthStore) CreateIndexesIfNotExists() {
func (as SqlOAuthStore) SaveApp(app *model.OAuthApp) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -91,7 +92,7 @@ func (as SqlOAuthStore) SaveApp(app *model.OAuthApp) StoreChannel {
func (as SqlOAuthStore) UpdateApp(app *model.OAuthApp) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -131,7 +132,7 @@ func (as SqlOAuthStore) UpdateApp(app *model.OAuthApp) StoreChannel {
func (as SqlOAuthStore) GetApp(id string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -154,7 +155,7 @@ func (as SqlOAuthStore) GetApp(id string) StoreChannel {
func (as SqlOAuthStore) GetAppByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -176,7 +177,7 @@ func (as SqlOAuthStore) GetAppByUser(userId string) StoreChannel {
func (as SqlOAuthStore) GetApps() StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -197,7 +198,7 @@ func (as SqlOAuthStore) GetApps() StoreChannel {
}
func (as SqlOAuthStore) GetAuthorizedApps(userId string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -220,7 +221,7 @@ func (as SqlOAuthStore) GetAuthorizedApps(userId string) StoreChannel {
}
func (as SqlOAuthStore) DeleteApp(id string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -255,7 +256,7 @@ func (as SqlOAuthStore) DeleteApp(id string) StoreChannel {
func (as SqlOAuthStore) SaveAccessData(accessData *model.AccessData) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -281,7 +282,7 @@ func (as SqlOAuthStore) SaveAccessData(accessData *model.AccessData) StoreChanne
func (as SqlOAuthStore) GetAccessData(token string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -304,7 +305,7 @@ func (as SqlOAuthStore) GetAccessData(token string) StoreChannel {
func (as SqlOAuthStore) GetAccessDataByUserForApp(userId, clientId string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -331,7 +332,7 @@ func (as SqlOAuthStore) GetAccessDataByUserForApp(userId, clientId string) Store
func (as SqlOAuthStore) GetAccessDataByRefreshToken(token string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -354,7 +355,7 @@ func (as SqlOAuthStore) GetAccessDataByRefreshToken(token string) StoreChannel {
func (as SqlOAuthStore) GetPreviousAccessData(userId, clientId string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -381,7 +382,7 @@ func (as SqlOAuthStore) GetPreviousAccessData(userId, clientId string) StoreChan
}
func (as SqlOAuthStore) UpdateAccessData(accessData *model.AccessData) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -402,7 +403,7 @@ func (as SqlOAuthStore) UpdateAccessData(accessData *model.AccessData) StoreChan
}
func (as SqlOAuthStore) RemoveAccessData(token string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -420,7 +421,7 @@ func (as SqlOAuthStore) RemoveAccessData(token string) StoreChannel {
func (as SqlOAuthStore) SaveAuthData(authData *model.AuthData) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -447,7 +448,7 @@ func (as SqlOAuthStore) SaveAuthData(authData *model.AuthData) StoreChannel {
func (as SqlOAuthStore) GetAuthData(code string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -469,7 +470,7 @@ func (as SqlOAuthStore) GetAuthData(code string) StoreChannel {
}
func (as SqlOAuthStore) RemoveAuthData(code string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}
@@ -487,7 +488,7 @@ func (as SqlOAuthStore) RemoveAuthData(code string) StoreChannel {
}
func (as SqlOAuthStore) PermanentDeleteAuthDataByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
storeChannel := make(StoreChannel, 1)
go func() {
result := StoreResult{}