You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ti...@apache.org on 2021/01/19 08:40:27 UTC
[servicecomb-service-center] branch master updated: Set the default
timeout for instance (#832)
This is an automated email from the ASF dual-hosted git repository.
tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git
The following commit(s) were added to refs/heads/master by this push:
new 6b47e2f Set the default timeout for instance (#832)
6b47e2f is described below
commit 6b47e2fbb4f0059a195be65eac5a2cf046dedaf6
Author: robotLJW <79...@qq.com>
AuthorDate: Tue Jan 19 16:40:16 2021 +0800
Set the default timeout for instance (#832)
---
datasource/mongo/mongo.go | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/datasource/mongo/mongo.go b/datasource/mongo/mongo.go
index 1e84d84..2f742a7 100644
--- a/datasource/mongo/mongo.go
+++ b/datasource/mongo/mongo.go
@@ -106,7 +106,12 @@ func (ds *DataSource) createIndexes() (err error) {
Keys: bsonx.Doc{{Key: StringBuilder([]string{ColumnServiceInfo, ColumnServiceID}), Value: bsonx.Int32(1)}},
Options: options.Index().SetUnique(true),
}, {
- Keys: bsonx.Doc{{Key: StringBuilder([]string{ColumnServiceInfo, ColumnAppID}), Value: bsonx.Int32(1)}, {Key: StringBuilder([]string{ColumnServiceInfo, ColumnServiceName}), Value: bsonx.Int32(1)}, {Key: StringBuilder([]string{ColumnServiceInfo, ColumnEnv}), Value: bsonx.Int32(1)}, {Key: StringBuilder([]string{ColumnServiceInfo, ColumnVersion}), Value: bsonx.Int32(1)}},
+ Keys: bsonx.Doc{{Key: StringBuilder([]string{ColumnServiceInfo, ColumnAppID}), Value: bsonx.Int32(1)},
+ {Key: StringBuilder([]string{ColumnServiceInfo, ColumnServiceName}), Value: bsonx.Int32(1)},
+ {Key: StringBuilder([]string{ColumnServiceInfo, ColumnEnv}), Value: bsonx.Int32(1)},
+ {Key: StringBuilder([]string{ColumnServiceInfo, ColumnVersion}), Value: bsonx.Int32(1)},
+ {Key: ColumnDomain, Value: bsonx.Int32(1)},
+ },
Options: options.Index().SetUnique(true),
}})
if err != nil {
@@ -115,7 +120,12 @@ func (ds *DataSource) createIndexes() (err error) {
err = client.GetMongoClient().CreateIndexes(context.TODO(), CollectionInstance, []mongo.IndexModel{{
Keys: bsonx.Doc{{Key: StringBuilder([]string{ColumnInstanceInfo, ColumnInstanceID}), Value: bsonx.Int32(1)}},
Options: options.Index().SetUnique(true),
- }, {Keys: bsonx.Doc{{Key: StringBuilder([]string{ColumnInstanceID, ColumnServiceID}), Value: bsonx.Int32(1)}}}})
+ }, {
+ Keys: bsonx.Doc{{Key: StringBuilder([]string{ColumnInstanceID, ColumnServiceID}), Value: bsonx.Int32(1)}},
+ }, {
+ Keys: bsonx.Doc{{Key: ColumnRefreshTime, Value: bsonx.Int32(1)}},
+ Options: options.Index().SetExpireAfterSeconds(60),
+ }})
if err != nil {
return
}