Skip to content

Commit 6a25e72

Browse files
Fix: changes id
1 parent 021461d commit 6a25e72

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/module/module.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ func (m *Module) sync(ctx context.Context) error {
158158
cids := make(map[string]storage.Celestial)
159159
addressIds := make(map[uint64]struct{})
160160

161+
var lastId int64
161162
for i := range changes.Changes {
162163
if m.state.ChangeId >= changes.Changes[i].ChangeID {
163164
continue
164165
}
165-
m.state.ChangeId = changes.Changes[i].ChangeID
166166
addressId, err := m.addressHandler(ctx, changes.Changes[i].Address)
167167
if err != nil {
168168
return errors.Wrap(err, "address handler")
@@ -184,11 +184,13 @@ func (m *Module) sync(ctx context.Context) error {
184184
ChangeId: changes.Changes[i].ChangeID,
185185
Status: status,
186186
}
187+
lastId = changes.Changes[i].ChangeID
187188
}
188189

189190
if err := m.save(ctx, cids, addressIds); err != nil {
190191
return errors.Wrap(err, "save")
191192
}
193+
m.state.ChangeId = lastId
192194
log.Debug().
193195
Int("changes_count", len(cids)).
194196
Int64("head", m.state.ChangeId).

0 commit comments

Comments
 (0)