Skip to content

Commit c97eb86

Browse files
authored
PML-154: IntitialSync.completed status flips (#90)
1 parent e20c005 commit c97eb86

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

.github/workflows/e2etests.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# .github/workflows/e2e-tests.yml
22
name: E2E Tests
33

4-
on:
5-
push:
6-
branches: [main]
7-
pull_request:
8-
branches: [main]
4+
on: [pull_request]
95

106
jobs:
117
rs:

.github/workflows/go.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: code
2-
on:
3-
push:
4-
branches: ["main"]
5-
pull_request:
6-
branches: ["main"]
2+
3+
on: [pull_request]
74

85
jobs:
96
test:

.github/workflows/reviewdog.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: reviewdog
2+
23
on: [pull_request]
4+
35
jobs:
46
misspell:
57
name: misspell

.github/workflows/trivy.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Scan
2-
on:
3-
push:
4-
branches: ["main"]
5-
pull_request:
6-
branches: ["main"]
2+
3+
on: [pull_request]
4+
75
jobs:
86
scan:
97
name: Trivy

mongolink/mongolink.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ func (ml *MongoLink) Status(ctx context.Context) *Status {
245245
s.Error = errors.Wrap(s.Clone.Err, "Clone")
246246
}
247247

248+
if s.Repl.IsStarted() {
249+
intialSyncLag := max(int64(s.Clone.FinishTS.T)-int64(s.Repl.LastReplicatedOpTime.T), 0)
250+
s.InitialSyncLagTime = &intialSyncLag
251+
s.InitialSyncCompleted = s.Repl.LastReplicatedOpTime.After(s.Clone.FinishTS)
252+
}
253+
248254
if ml.state == StateFailed {
249255
return s
250256
}
@@ -266,12 +272,6 @@ func (ml *MongoLink) Status(ctx context.Context) *Status {
266272

267273
s.InitialSyncLagTime = s.TotalLagTime
268274

269-
if s.Repl.IsStarted() {
270-
intialSyncLag := max(int64(s.Clone.FinishTS.T)-int64(s.Repl.LastReplicatedOpTime.T), 0)
271-
s.InitialSyncLagTime = &intialSyncLag
272-
s.InitialSyncCompleted = s.Repl.LastReplicatedOpTime.After(s.Clone.FinishTS)
273-
}
274-
275275
return s
276276
}
277277

0 commit comments

Comments
 (0)