You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by "holden-cpu (via GitHub)" <gi...@apache.org> on 2025/02/19 02:41:56 UTC

[PR] Feature: add sync readiness checker [servicecomb-service-center]

holden-cpu opened a new pull request, #1499:
URL: https://github.com/apache/servicecomb-service-center/pull/1499

   Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line and body.
    - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue.
    - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [ ] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
    - [ ] Never comment source code, delete it.
    - [ ] UT should has "context, subject, expected result" result as test case name, when you call t.Run().
   ---
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feature: add sync readiness checker [servicecomb-service-center]

Posted by "humingcheng (via GitHub)" <gi...@apache.org>.
humingcheng merged PR #1499:
URL: https://github.com/apache/servicecomb-service-center/pull/1499


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feature: add sync readiness checker [servicecomb-service-center]

Posted by "humingcheng (via GitHub)" <gi...@apache.org>.
humingcheng commented on code in PR #1499:
URL: https://github.com/apache/servicecomb-service-center/pull/1499#discussion_r1961152086


##########
server/health/health.go:
##########
@@ -19,12 +19,18 @@ package health
 
 import (
 	"errors"
+	"fmt"
+	"time"
 
+	"github.com/apache/servicecomb-service-center/pkg/log"
 	"github.com/apache/servicecomb-service-center/server/alarm"
+	"github.com/apache/servicecomb-service-center/syncer/config"
+	"github.com/apache/servicecomb-service-center/syncer/rpc"
 )
 
 var healthChecker Checker = &NullChecker{}
 var readinessChecker Checker = &DefaultHealthChecker{}
+var syncReadinessChecker Checker = &SyncReadinessChecker{startupTime: time.Now()}

Review Comment:
   起始时间点,应该是http对外提供服务的时间点,判断的条件是 !server.GetAPIServer().IsClose()



##########
server/health/health.go:
##########
@@ -65,5 +99,8 @@ func SetGlobalReadinessChecker(hc Checker) {
 }
 
 func GlobalReadinessChecker() Checker {
+	if config.GetConfig().Sync.EnableOnStart {

Review Comment:
   这两个checker都要运行,另一个不能丢。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feature: add sync readiness checker [servicecomb-service-center]

Posted by "humingcheng (via GitHub)" <gi...@apache.org>.
humingcheng commented on code in PR #1499:
URL: https://github.com/apache/servicecomb-service-center/pull/1499#discussion_r1961173197


##########
server/health/health.go:
##########
@@ -40,7 +46,35 @@ func (n NullChecker) Healthy() error {
 type DefaultHealthChecker struct {
 }
 
+type SyncReadinessChecker struct {
+	startupTime time.Time
+}
+
+func (src *SyncReadinessChecker) Healthy() error {
+	err := defaultHealth()
+	if err != nil {
+		return err
+	}
+
+	passTime := src.startupTime.Add(30 * time.Second)
+	if !rpc.IsNotReceiveSyncRequest() && rpc.GetFirstReceiveTime().Sub(src.startupTime) < 30*time.Second {
+		passTime = passTime.Add(rpc.GetFirstReceiveTime().Sub(src.startupTime))

Review Comment:
   有点绕,实际上是 T_start + 30 + T_firstRecieve - T_start = 30 + T_firstRecieve



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org