Add cws availability check.
Этот коммит содержится в:
@@ -751,7 +751,7 @@ func handleCWSWebhook(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func handleCheckCWSConnection(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
if err := c.App.Cloud().CheckCWSConnection(); err != nil {
|
||||
if err := c.App.Cloud().CheckCWSConnection(c.AppContext.Session().UserId); err != nil {
|
||||
c.Err = model.NewAppError("Api4.handleCWSHealthCheck", "api.server.cws.health_check.app_error", nil, "CWS Server is not available.", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -46,5 +46,5 @@ type CloudInterface interface {
|
||||
CreateOrUpdateSubscriptionHistoryEvent(userID string, userCount int) (*model.SubscriptionHistory, error)
|
||||
HandleLicenseChange() error
|
||||
|
||||
CheckCWSConnection() error
|
||||
CheckCWSConnection(userId string) error
|
||||
}
|
||||
|
||||
@@ -60,13 +60,13 @@ func (_m *CloudInterface) ChangeSubscription(userID string, subscriptionID strin
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CheckCWSConnection provides a mock function with given fields:
|
||||
func (_m *CloudInterface) CheckCWSConnection() error {
|
||||
ret := _m.Called()
|
||||
// CheckCWSConnection provides a mock function with given fields: userId
|
||||
func (_m *CloudInterface) CheckCWSConnection(userId string) error {
|
||||
ret := _m.Called(userId)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func() error); ok {
|
||||
r0 = rf()
|
||||
if rf, ok := ret.Get(0).(func(string) error); ok {
|
||||
r0 = rf(userId)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
@@ -8700,7 +8700,7 @@ func (c *Client4) AddUserToGroupSyncables(userID string) (*Response, error) {
|
||||
return BuildResponse(r), nil
|
||||
}
|
||||
|
||||
func (c *Client4) CheckCWSConnection() (*Response, error) {
|
||||
func (c *Client4) CheckCWSConnection(userId string) (*Response, error) {
|
||||
r, err := c.DoAPIGet(c.cloudRoute()+"/healthz", "")
|
||||
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user