Skip to content

Commit

Permalink
celeray task
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-g committed Sep 15, 2024
1 parent 6cc3a8b commit 560895a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion say/api/need_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions say/models/need_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion say/tasks/update_needs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 560895a

Please sign in to comment.