forked from CGM_Public/pretix_original
Limit batch size in bulk voucher creation (avoid problems with MySQL's max_packet_size)
This commit is contained in:
@@ -393,7 +393,7 @@ class VoucherBulkForm(VoucherForm):
|
|||||||
data['bulk'] = True
|
data['bulk'] = True
|
||||||
del data['codes']
|
del data['codes']
|
||||||
objs.append(obj)
|
objs.append(obj)
|
||||||
Voucher.objects.bulk_create(objs)
|
Voucher.objects.bulk_create(objs, batch_size=200)
|
||||||
objs = []
|
objs = []
|
||||||
for v in event.vouchers.filter(code__in=self.cleaned_data['codes']):
|
for v in event.vouchers.filter(code__in=self.cleaned_data['codes']):
|
||||||
# We need to query them again as bulk_create does not fill in .pk values on databases
|
# We need to query them again as bulk_create does not fill in .pk values on databases
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ class VoucherBulkCreate(EventPermissionRequiredMixin, CreateView):
|
|||||||
v.log_action('pretix.voucher.added', data=form.cleaned_data, user=self.request.user, save=False)
|
v.log_action('pretix.voucher.added', data=form.cleaned_data, user=self.request.user, save=False)
|
||||||
)
|
)
|
||||||
voucherids.append(v.pk)
|
voucherids.append(v.pk)
|
||||||
LogEntry.objects.bulk_create(log_entries)
|
LogEntry.objects.bulk_create(log_entries, batch_size=200)
|
||||||
|
|
||||||
if form.cleaned_data['send']:
|
if form.cleaned_data['send']:
|
||||||
vouchers_send.apply_async(kwargs={
|
vouchers_send.apply_async(kwargs={
|
||||||
|
|||||||
Reference in New Issue
Block a user