add CounterServiceURL in api config
diff --git a/init.go b/init.go
index 8938f9a..52cd629 100644
--- a/init.go
+++ b/init.go
@@ -29,13 +29,11 @@
globalVariables.Config.SetDefault(constants.ConfigQuotaBasePath, constants.QuotaBasePathDefault)
counterServiceBasePath := globalVariables.Config.Get(constants.ConfigCounterServiceBasePath)
- fmt.Println("counterBasePath: ", counterServiceBasePath, "//")
if counterServiceBasePath != nil {
if reflect.TypeOf(counterServiceBasePath).Kind() != reflect.String {
globalVariables.Log.Fatal("value of: " + constants.ConfigCounterServiceBasePath + " in the config should be string")
}
globalVariables.CounterServiceURL = counterServiceBasePath.(string)
}
- globalVariables.CounterServiceURL = "http://54.86.114.219:8989/increment" //todo: comment it once the above code works.
}
diff --git a/quotaBucket/quotaBucket.go b/quotaBucket/quotaBucket.go
index 871baa5..c06247f 100644
--- a/quotaBucket/quotaBucket.go
+++ b/quotaBucket/quotaBucket.go
@@ -284,6 +284,7 @@
return nil, err
}
+ fmt.Println("currentcount1: ", currentCount)
fmt.Println("startTime get period : ", period.GetPeriodStartTime().String())
fmt.Println("endTime get period : ", period.GetPeriodEndTime().String())
@@ -295,14 +296,14 @@
if allowed > weight {
if weight != 0 {
-
currentCount, err = services.IncrementAndGetCount(q.GetEdgeOrgID(), q.GetID(), weight, period.GetPeriodStartTime().Unix(), period.GetPeriodEndTime().Unix())
+ fmt.Println("currentcount2: ", currentCount)
if err != nil {
return nil, err
}
}
- allowedCount = currentCount + weight
+ allowedCount = currentCount
} else {
if weight != 0 {
diff --git a/services/counterServiceHelper.go b/services/counterServiceHelper.go
index 1f08a6b..13afa98 100644
--- a/services/counterServiceHelper.go
+++ b/services/counterServiceHelper.go
@@ -17,6 +17,8 @@
edgeOrgID = "orgId"
key = "key"
delta = "delta"
+ startTime = "startTime"
+ endTime = "endTime"
)
var client *http.Client = &http.Client{
@@ -45,8 +47,8 @@
reqBody[edgeOrgID] = orgID
reqBody[key] = quotaKey
reqBody[delta] = count
- reqBody["startTime"] = startTimeInt
- reqBody["endTime"] = endTimeInt
+ reqBody[startTime] = startTimeInt * int64(1000)
+ reqBody[endTime] = endTimeInt * int64(1000)
fmt.Println("startTime: ", startTimeInt)
fmt.Println("endTime: ", endTimeInt)