ox-ai-workers 1.1.3 → 1.1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/oxaiworkers/iterator.rb +19 -0
- data/lib/oxaiworkers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56e2ee5c343058a40443b708c42546c7f76ce0c9915ab54b74a28215ce664a0a
|
4
|
+
data.tar.gz: 3dd61c2eb153ea379b5e53871b1fae4805dca163526de51a4e40cf8407030cdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 303e386cb438f35cde00787ea617a12215394e712932e15995bc9629f4d210cdccde0031262b80ea4221bc9441366f32a2c16702ecfc01917fbba4ddaebb42d6
|
7
|
+
data.tar.gz: 1590ee68bdf1d6e4b5c31b02839ff5b28b4f298719f68c3ac0dac2ffc3938f7f7334f4c522ecbc2409fec3cb7135884d3bcbc5fcbfc9e0bc629ea09b820c9f3a
|
data/CHANGELOG.md
CHANGED
data/lib/oxaiworkers/iterator.rb
CHANGED
@@ -176,6 +176,13 @@ module OxAiWorkers
|
|
176
176
|
end
|
177
177
|
|
178
178
|
def next_iteration
|
179
|
+
# Проверяем call_stack перед продолжением итерации
|
180
|
+
if should_finish_iteration?
|
181
|
+
OxAiWorkers.logger.info "Iterator::Call stack is empty or contains only finish_it. Finishing iteration."
|
182
|
+
finish_it
|
183
|
+
return
|
184
|
+
end
|
185
|
+
|
179
186
|
# Сначала добавляем сообщения из очереди к worker
|
180
187
|
@worker.append(messages: @queue)
|
181
188
|
# Затем добавляем их к локальным сообщениям
|
@@ -186,6 +193,18 @@ module OxAiWorkers
|
|
186
193
|
request!
|
187
194
|
end
|
188
195
|
|
196
|
+
def should_finish_iteration?
|
197
|
+
return false if @worker.call_stack.nil?
|
198
|
+
return false unless @worker.respond_to?(:call_stack) && @worker.call_stack.present?
|
199
|
+
|
200
|
+
finish_it_function = OxAiWorkers::Iterator.full_function_name(:finish_it)
|
201
|
+
|
202
|
+
# Проверяем, пуста ли очередь вызовов или содержит только finish_it
|
203
|
+
@worker.call_stack.empty? ||
|
204
|
+
(@worker.call_stack.size == 1 && @worker.call_stack.first == finish_it_function) ||
|
205
|
+
@worker.call_stack.all? { |call| call == finish_it_function }
|
206
|
+
end
|
207
|
+
|
189
208
|
def external_request
|
190
209
|
@worker.request!
|
191
210
|
tick_or_wait
|
data/lib/oxaiworkers/version.rb
CHANGED