Skip to content

Commit 79489f1

Browse files
fix: make lti plugin synchonous (#310)
* fix: make celery lti task synchonous * fix: removed placeholder aud from bearer token func
1 parent 1c3529e commit 79489f1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

grader_service/autograding/celery/tasks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
from typing import Union
23

34
from celery import Celery, Task
@@ -86,7 +87,7 @@ def generate_feedback_task(self: GraderTask, lecture_id: int, assignment_id: int
8687

8788

8889
@app.task(bind=True, base=GraderTask)
89-
async def lti_sync_task(
90+
def lti_sync_task(
9091
self: GraderTask,
9192
lecture: dict,
9293
assignment: dict,
@@ -105,7 +106,7 @@ async def lti_sync_task(
105106
lecture, assignment, submissions, feedback_sync=feedback_sync
106107
):
107108
try:
108-
results = await lti_plugin.start(lecture, assignment, submissions)
109+
results = asyncio.run(lti_plugin.start(lecture, assignment, submissions))
109110
return results
110111
except HTTPError as e:
111112
err_msg = f"Could not sync grades: {e.reason}"

grader_service/plugins/lti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ async def request_bearer_token(self):
289289
payload = {
290290
"iss": "grader-service",
291291
"sub": self.client_id,
292-
"aud": ["http://127.0.0.1/mod/lti/token.php"],
292+
"aud": [self.token_url],
293293
"iat": str(int(time.time())),
294294
"exp": str(int(time.time()) + 60),
295295
"jti": str(int(time.time())) + "123",

0 commit comments

Comments
 (0)