From 560895a06b6713239989e7d9001e4bbb033a9fc4 Mon Sep 17 00:00:00 2001 From: ehsang Date: Sun, 15 Sep 2024 21:30:34 +0330 Subject: [PATCH] celeray task --- say/api/need_api.py | 2 +- say/models/need_model.py | 4 ++-- say/tasks/update_needs.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/say/api/need_api.py b/say/api/need_api.py index ffd7fb28..144c354e 100644 --- a/say/api/need_api.py +++ b/say/api/need_api.py @@ -330,7 +330,7 @@ def patch(self, need_id): if 'link' in request.form.keys(): new_link = request.form['link'] from say.tasks import update_need - + print("updating link...") need.link = new_link session.flush() update_need.delay(need.id) diff --git a/say/models/need_model.py b/say/models/need_model.py index fe3b62c1..a6d4ee83 100644 --- a/say/models/need_model.py +++ b/say/models/need_model.py @@ -442,12 +442,12 @@ def current_participants(self): paid=past_participation.paid, ) - def update(self, force=False): + def update(self,need_id, force=False): from say.crawler import Crawler from say.crawler import DigikalaCrawler if 'digikala' in self.link: - data = DigikalaCrawler(self.link).get_data(self.id, force=force) + data = DigikalaCrawler(self.link).get_data(need_id, force=force) else: data = Crawler(self.link).get_data(force=force) diff --git a/say/tasks/update_needs.py b/say/tasks/update_needs.py index 06817c21..3e41dc6b 100644 --- a/say/tasks/update_needs.py +++ b/say/tasks/update_needs.py @@ -41,7 +41,7 @@ def update_need(self, need_id, force=False): sleep(5) need = self.session.query(Need).get(need_id) - data = need.update(force=force) + data = need.update(need_id, force=force) safe_commit(self.session) return data