danicor commited on
Commit
08387a3
·
verified ·
1 Parent(s): 88dc826

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -215,8 +215,8 @@ class TranslationOrchestrator:
215
  'text': job_data['text'],
216
  'source_lang': job_data['source_lang'],
217
  'target_lang': job_data['target_lang'],
218
- 'auto_charge': job_data.get('auto_charge', False),
219
- 'notification_url': None
220
  }
221
 
222
  response = requests.post(
@@ -230,7 +230,7 @@ class TranslationOrchestrator:
230
  self.monitor_worker_job(worker_id, request_id)
231
  else:
232
  self.handle_worker_failure(worker_id, request_id, f"HTTP {response.status_code}")
233
-
234
  except Exception as e:
235
  self.handle_worker_failure(worker_id, request_id, str(e))
236
 
@@ -279,6 +279,7 @@ class TranslationOrchestrator:
279
 
280
  processing_time = time.time() - job_info.get('start_time', time.time())
281
 
 
282
  completion_data = {
283
  'request_id': request_id,
284
  'status': 'completed',
@@ -296,9 +297,8 @@ class TranslationOrchestrator:
296
  if request_id in self.active_jobs:
297
  del self.active_jobs[request_id]
298
 
299
- notification_url = job_data.get('notification_url')
300
- if notification_url:
301
- self.notify_wordpress(notification_url, completion_data)
302
 
303
  def handle_worker_failure(self, worker_id: str, request_id: str, error_message: str):
304
  worker = self.workers[worker_id]
 
215
  'text': job_data['text'],
216
  'source_lang': job_data['source_lang'],
217
  'target_lang': job_data['target_lang'],
218
+ 'auto_charge': False, # حذف auto_charge - orchestrator مدیریت می‌کند
219
+ 'notification_url': None # حذف notification
220
  }
221
 
222
  response = requests.post(
 
230
  self.monitor_worker_job(worker_id, request_id)
231
  else:
232
  self.handle_worker_failure(worker_id, request_id, f"HTTP {response.status_code}")
233
+
234
  except Exception as e:
235
  self.handle_worker_failure(worker_id, request_id, str(e))
236
 
 
279
 
280
  processing_time = time.time() - job_info.get('start_time', time.time())
281
 
282
+ # ذخیره نتیجه برای دریافت توسط WordPress
283
  completion_data = {
284
  'request_id': request_id,
285
  'status': 'completed',
 
297
  if request_id in self.active_jobs:
298
  del self.active_jobs[request_id]
299
 
300
+ # حذف notification به WordPress
301
+ print(f"✅ Result stored for {request_id}, waiting for WordPress to fetch")
 
302
 
303
  def handle_worker_failure(self, worker_id: str, request_id: str, error_message: str):
304
  worker = self.workers[worker_id]