Skip to content

Commit

Permalink
fix delete logic (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
alyakimenko committed Sep 16, 2022
1 parent 0364a85 commit db39e39
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions source/iterator/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,21 @@ func (w *CDCIterator) producer() error {

for _, item := range resp.Segment.BlobItems {
itemLastModificationDate := *item.Properties.LastModified
itemDeletionTime := item.Properties.DeletedTime

// Reject item when it wasn't modified since the last iteration
// Reject item when it wasn't modified or deleted since the last iteration
if itemLastModificationDate.Before(w.lastModified) {
continue
if itemDeletionTime != nil && itemDeletionTime.After(w.lastModified) {
itemLastModificationDate = *itemDeletionTime
} else {
continue
}
}

// Prepare the sdk.Record
var output sdk.Record

if nil != item.Deleted && *item.Deleted {
if item.Deleted != nil && *item.Deleted {
var err error

output, err = w.createDeletedRecord(item)
Expand Down

0 comments on commit db39e39

Please sign in to comment.