Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quota modify #142

Merged
merged 27 commits into from Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f13bb75
find api dependency rule bug fix
aseTo2016 Sep 26, 2017
91d20a0
find api dependency rule bug fix
aseTo2016 Sep 26, 2017
1935b36
quota apply bug fix
aseTo2016 Sep 28, 2017
b1fcce4
Merge pull request #1 from ServiceComb/master
aseTo2016 Sep 28, 2017
d605d8e
Merge pull request #2 from ServiceComb/master
aseTo2016 Sep 28, 2017
eedc2f2
Merge pull request #3 from ServiceComb/master
aseTo2016 Oct 12, 2017
f6dce65
Merge pull request #4 from ServiceComb/master
aseTo2016 Oct 16, 2017
c62c189
http client bug fix
aseTo2016 Oct 16, 2017
c12d346
Merge pull request #5 from ServiceComb/master
aseTo2016 Oct 17, 2017
d24881b
Merge pull request #6 from ServiceComb/master
aseTo2016 Oct 17, 2017
6a24226
Merge pull request #6 from ServiceComb/master
aseTo2016 Oct 17, 2017
e1de8d4
Merge branch 'master' of https://github.com/aseTo2016/service-center …
aseTo2016 Oct 17, 2017
90738b2
Merge branch 'master' of https://github.com/ServiceComb/service-center
aseTo2016 Oct 19, 2017
958a7f2
add upload schemas api
aseTo2016 Oct 19, 2017
88cd997
Merge branch 'master' of https://github.com/aseTo2016/service-center
aseTo2016 Oct 19, 2017
92f648b
upload schemas,add info in services.yaml
aseTo2016 Oct 19, 2017
ffcaecd
Merge pull request #7 from ServiceComb/master
aseTo2016 Oct 19, 2017
fccb287
delete service bug fix
aseTo2016 Oct 20, 2017
f3e0155
Merge branch 'master' of https://github.com/aseTo2016/service-center
aseTo2016 Oct 20, 2017
13763ca
Merge pull request #8 from ServiceComb/master
aseTo2016 Oct 21, 2017
1f1e5c9
find dependency bug fix
aseTo2016 Oct 21, 2017
fc479ba
Merge pull request #9 from ServiceComb/master
aseTo2016 Oct 26, 2017
9070961
find dependency bug fix
aseTo2016 Oct 26, 2017
f53cbd1
update gov service 's response
aseTo2016 Oct 26, 2017
ca57f41
update gov service response
aseTo2016 Oct 26, 2017
f5f8f55
Merge pull request #10 from ServiceComb/master
aseTo2016 Oct 27, 2017
cde2b29
quota modify
aseTo2016 Oct 27, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions server/service/event/instance_event_handler.go
Expand Up @@ -21,6 +21,8 @@ import (
nf "github.com/ServiceComb/service-center/server/service/notification"
serviceUtil "github.com/ServiceComb/service-center/server/service/util"
"golang.org/x/net/context"
"strings"
apt "github.com/ServiceComb/service-center/server/core"
)

type InstanceEventHandler struct {
Expand All @@ -40,6 +42,17 @@ func (h *InstanceEventHandler) OnEvent(evt *store.KvEvent) {
providerId, providerInstanceId, action)
return
}
if action == pb.EVT_DELETE {
spilted := strings.Split(tenantProject, "/")
if len(spilted) == 2 && apt.IsDefaultDomain(tenantProject) {
domainName := spilted[0]
projectName := spilted[1]
ctx := context.TODO()
ctx = context.WithValue(ctx, "tenant", domainName)
ctx = context.WithValue(ctx, "project", projectName)
serviceUtil.RemandInstanceQuota(ctx)
}
}

if nf.GetNotifyService().Closed() {
util.Logger().Warnf(nil, "caught instance %s/%s [%s] event, but notify service is closed",
Expand Down
2 changes: 0 additions & 2 deletions server/service/instances.go
Expand Up @@ -275,8 +275,6 @@ func (s *InstanceController) Unregister(ctx context.Context, in *pb.UnregisterIn
}, nil
}

serviceUtil.RemandInstanceQuota(ctx)

util.Logger().Infof("unregister instance successful isntance %s, operator %s.", instanceFlag, remoteIP)
return &pb.UnregisterInstanceResponse{
Response: pb.CreateResponse(pb.Response_SUCCESS, "Unregister service instance successfully."),
Expand Down
1 change: 0 additions & 1 deletion server/service/util/microservice_util.go
Expand Up @@ -232,7 +232,6 @@ func GetAllServiceUtil(ctx context.Context, opts ...registry.PluginOpOption) ([]

func RemandServiceQuota(ctx context.Context) {
quota.QuotaPlugins[quota.QuataType]().RemandQuotas(ctx, quota.MicroServiceQuotaType)
RemandInstanceQuota(ctx)
}

func RemandInstanceQuota(ctx context.Context) {
Expand Down