@@ -15,7 +15,7 @@ import (
15
15
)
16
16
17
17
type Sync interface {
18
- Run (context.Context ) error
18
+ Run (context.Context , string ) error
19
19
}
20
20
21
21
type sync struct {
@@ -39,12 +39,12 @@ func NewSync(
39
39
}
40
40
}
41
41
42
- func (s * sync ) Run (ctx context.Context ) error {
42
+ func (s * sync ) Run (ctx context.Context , namespace string ) error {
43
43
s .logger .Info ("Starting sync" )
44
44
45
45
s .logger .Debug ("Warming up" )
46
46
47
- err := s .Warmup (ctx )
47
+ err := s .Warmup (ctx , namespace )
48
48
if err != nil {
49
49
return errors .Wrap (err , "warmup failed" )
50
50
}
@@ -139,15 +139,17 @@ func (s *sync) Run(ctx context.Context) error {
139
139
return g .Wait ()
140
140
}
141
141
142
- func (s * sync ) Warmup (ctx context.Context ) error {
142
+ func (s * sync ) Warmup (ctx context.Context , namespace string ) error {
143
143
g , ctx := errgroup .WithContext (ctx )
144
144
145
145
resource := s .factory ()
146
146
entities , err := s .db .YieldAll (ctx , func () database.Entity {
147
147
return s .factory ()
148
- }, s .db .BuildSelectStmt (resource , resource .Fingerprint ()), struct {}{ })
148
+ }, s .db .BuildSelectStmt (resource , resource .Fingerprint ()), struct { Namespace string }{ Namespace : namespace })
149
149
com .ErrgroupReceive (ctx , g , err )
150
150
151
+ fmt .Println (s .db .BuildSelectStmt (resource , resource .Fingerprint ()))
152
+
151
153
g .Go (func () error {
152
154
for {
153
155
select {
0 commit comments