lib/table_sync/model/sequel.rb in table_sync-1.8.0 vs lib/table_sync/model/sequel.rb in table_sync-1.9.0

- old
+ new

@@ -26,20 +26,27 @@ insert_data = type_cast(data) if first_sync_time_key insert_data.each { |datum| datum[first_sync_time_key] = Time.current } end - dataset.returning - .insert_conflict( - target: target_keys, - update: upd_spec, - update_where: version_condition, - ) - .multi_insert(insert_data) + result = dataset.returning + .insert_conflict( + target: target_keys, + update: upd_spec, + update_where: version_condition, + ) + .multi_insert(insert_data) + + TableSync::Instrument.notify table: table_name, count: result.count, + event: :update, direction: :receive + result end def destroy(data) - dataset.returning.where(data).delete + result = dataset.returning.where(data).delete + TableSync::Instrument.notify table: table_name, count: result.count, + event: :destroy, direction: :receive + result end def transaction(&block) db.transaction(&block) end