Skip to content

Commit 59539c4

Browse files
committed
fix in_batches cursor for uuidv4 primary keys
1 parent 62581ad commit 59539c4

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

lib/denormalizable.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,13 +470,7 @@ def denormalize_association_async(record, relation)
470470
# UUIDv4, cursor on insertion order when possible so that
471471
# records inserted mid-enumeration land ahead of the cursor
472472
# instead of being skipped behind it
473-
cursor = if relation.klass.column_names.include?('created_at')
474-
%w[created_at id]
475-
else
476-
relation.klass.primary_key
477-
end
478-
479-
relation.in_batches(of: DENORMALIZE_ASSOCIATION_ASYNC_BATCH_SIZE, cursor:) do |batch|
473+
relation.in_batches(of: DENORMALIZE_ASSOCIATION_ASYNC_BATCH_SIZE, cursor: %i[created_at id]) do |batch|
480474
DenormalizeAssociationAsyncJob.perform_later(
481475
source_class_name: record.class.name,
482476
source_id: record.id,

0 commit comments

Comments
 (0)