Skip to content

Commit 98941e5

Browse files
committed
Improve logging
1 parent e244371 commit 98941e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

readthedocs/projects/tasks/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,14 @@ def deprecated_config_file_used_notification():
256256
users = set()
257257

258258
queryset = Project.objects.filter(slug__in=projects).order_by("id")
259-
start_datetime = datetime.datetime.now()
260259
for i, project in enumerate(queryset.iterator()):
261260
if i % 500 == 0:
262261
log.info(
263262
"Querying all the users we want to contact.",
264263
progress=f"{i}/{n_projects}",
265264
current_project_pk=project.pk,
266265
current_project_slug=project.slug,
266+
time_elapsed=(datetime.datetime.now() - start_datetime).seconds,
267267
)
268268

269269
users.update(AdminPermission.owners(project).values_list("username", flat=True))
@@ -282,6 +282,7 @@ def deprecated_config_file_used_notification():
282282
progress=f"{i}/{n_users}",
283283
current_user_pk=user.pk,
284284
current_user_username=user.username,
285+
time_elapsed=(datetime.datetime.now() - start_datetime).seconds,
285286
)
286287

287288
# All the projects for this user that don't have a configuration file
@@ -305,7 +306,7 @@ def deprecated_config_file_used_notification():
305306

306307
log.info(
307308
"Finish sending deprecated config file notifications.",
308-
notification_seconds=(datetime.datetime.now() - start_datetime).seconds,
309+
time_elapsed=(datetime.datetime.now() - start_datetime).seconds,
309310
)
310311

311312

0 commit comments

Comments
 (0)