Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita14f9c6

Browse files
committed
Start user process when user loads course
1 parentfd5b4ed commita14f9c6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎backend/main/views.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
importtraceback
44
fromdatetimeimportdatetime
55
frompathlibimportPath
6+
fromthreadingimportThread
67
fromtimeimportsleep
78
fromtypingimportget_type_hints
89
fromuuidimportuuid4
@@ -145,6 +146,8 @@ def load_data(self):
145146
ifuser.is_anonymous:
146147
return {}
147148

149+
Thread(target=self.warmup_user_process).start()
150+
148151
returndict(
149152
pages=[
150153
dict(**select_attrs(page,"slug title index"),steps=page.step_dicts)
@@ -158,6 +161,18 @@ def load_data(self):
158161
page_index=pages[self.user.page_slug].index,
159162
)
160163

164+
defwarmup_user_process(self):
165+
page_slug=page_slugs_list[0]
166+
step_name=pages[page_slug].step_names[0]
167+
entry_dict=dict(
168+
input="# dummy startup code",
169+
source="shell",
170+
page_slug=page_slug,
171+
step_name=step_name,
172+
user_id=self.user.id,
173+
)
174+
worker_result(entry_dict)
175+
161176
defset_developer_mode(self,value:bool):
162177
self.user.developer_mode=value
163178
self.user.save()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp