[PR #22721] fix(dataset): CELERY_BROKER uses amqp rabbitmq. When adding document segments in batches and uploading large files, the status will always remain stuck at "In batch processing" #22709 #30029

Closed
opened 2026-02-21 20:46:42 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/22721

State: closed
Merged: No


Fixes #22709

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

The original "batch_create_segment_to_index_task" task would store all the contents of the file as the parameter "content" in the AMQP, and the size of the MQ message could be very large, even exceeding the "max_message_size" configuration of RabbitMQ, which could cause Celery to lose the task.
This modification changed the parameter of "batch_create_segment_to_index_task" from "content" to "upload_file_id". During the execution of the task, the file was downloaded and further processed to avoid large MQ messages.
If the Celery broker uses Redis, this modification can also prevent the occurrence of large Redis keys.

Screenshots

Before After
image image

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/22721 **State:** closed **Merged:** No --- Fixes #22709 > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 2. Ensure there is an associated issue and you have been assigned to it > 3. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary The original "batch_create_segment_to_index_task" task would store all the contents of the file as the parameter "content" in the AMQP, and the size of the MQ message could be very large, even exceeding the "max_message_size" configuration of RabbitMQ, which could cause Celery to lose the task. This modification changed the parameter of "batch_create_segment_to_index_task" from "content" to "upload_file_id". During the execution of the task, the file was downloaded and further processed to avoid large MQ messages. If the Celery broker uses Redis, this modification can also prevent the occurrence of large Redis keys. <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> ## Screenshots | Before | After | |--------|-------| | <img width="820" height="263" alt="image" src="https://github.com/user-attachments/assets/06f5c422-792b-4adc-b221-ffadf88e4f65" /> | <img width="737" height="640" alt="image" src="https://github.com/user-attachments/assets/cab96548-b750-41b6-a942-2783af58a91d" /> | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:46:42 -05:00
yindo closed this issue 2026-02-21 20:46:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30029