|
@@ -13,6 +13,7 @@ import com.backendsys.modules.sdk.comfyui.enums.TaskStatusEnums;
|
|
|
import com.backendsys.modules.sdk.comfyui.rabbitmq.ComfyuiQueueConfig;
|
|
|
import com.backendsys.modules.sdk.comfyui.rabbitmq.ComfyuiRabbitListener;
|
|
|
import com.backendsys.modules.sdk.comfyui.rabbitmq.DeliveryTagHolder;
|
|
|
+import com.backendsys.modules.sdk.comfyui.rabbitmq.TagCtx;
|
|
|
import com.backendsys.modules.sdk.comfyui.service.ComfyuiSocketService;
|
|
|
import com.backendsys.modules.sdk.comfyui.service.ComfyuiTaskService;
|
|
|
import com.backendsys.modules.sdk.comfyui.utils.ComfyuiUtil;
|
|
@@ -201,29 +202,30 @@ public class ComfyuiSocketServiceImpl implements ComfyuiSocketService {
|
|
|
// -- [RabbitMQ][完成当前队列任务,放行下一个队列] ----------------------------------------
|
|
|
try {
|
|
|
System.out.println("-- 准备放行队列 --");
|
|
|
- Connection connection = rabbitTemplate.getConnectionFactory().createConnection();
|
|
|
- Channel channel = connection.createChannel(false);
|
|
|
+// Connection connection = rabbitTemplate.getConnectionFactory().createConnection();
|
|
|
+// Channel channel = connection.createChannel(false);
|
|
|
// GetResponse resp = channel.basicGet(config.QUEUE, false);
|
|
|
|
|
|
// 已经被 Listener 的这里拿不到?
|
|
|
// 这里是空的?
|
|
|
- Long tag = deliveryTagHolder.take(client_id);
|
|
|
+ TagCtx tag = deliveryTagHolder.take(client_id);
|
|
|
+ Channel channel = tag.getChannel();
|
|
|
|
|
|
// 1) 手动确认消息 (ACK)
|
|
|
System.out.println("-- 手动确认消息 (ACK) ----------");
|
|
|
// channel.basicAck(resp.getEnvelope().getDeliveryTag(), false);
|
|
|
- channel.basicAck(tag, false);
|
|
|
-
|
|
|
+ System.out.println("client_id = " + client_id + ", tag = " + tag);
|
|
|
+ channel.basicAck(tag.getDeliveryTag(), false);
|
|
|
+ channel.close();
|
|
|
|
|
|
|
|
|
// 2) 清除队列锁 (QUEUE_LOCK_KEY)
|
|
|
-
|
|
|
String QUEUE_LOCK_KEY = APPLICATION_NAME + ":comfyui:queue:lock:user:" + Convert.toStr(user_id);
|
|
|
System.out.println("-- 清除队列锁 (QUEUE_LOCK_KEY): " + QUEUE_LOCK_KEY);
|
|
|
redisUtil.delete(QUEUE_LOCK_KEY);
|
|
|
|
|
|
- channel.close();
|
|
|
- connection.close();
|
|
|
+
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
}
|