Serializer Error When Listing All Time Users Directory

AI-generated summary

User kstaikov reported a 500 error and an infinite loading spinner when accessing the “All Time” directory list via /directory_items?period=all&order=likes_received, while other time periods function correctly. The UI displayed a blank user entry, likely a test account deleted after posting, and logs revealed a NoMethodError for time_read on a nil object in the directory_item_serializer. kstaikov clarified that the user was deleted via the UI after removing all posts, noting one topic was created while impersonating another user. Falco initially could not reproduce the issue and asked for details on the deletion process. Falco later hypothesized the error stemmed from a batch update job failing to run after the user deletion. However, kstaikov subsequently confirmed the issue resolved itself after a background job eventually executed, restoring normal functionality without manual intervention.

/directory_items?period=all&order=likes_received returns a 500.

On the UI, the spinner just spins forever if I have selected all time, otherwise the other options (weekly, monthly, etc.) load OK. However, they show a user that is blank that is probably a test user I deleted after making a post:

The logs show a serializer error:

NoMethodError (undefined method `time_read' for nil:NilClass) /var/www/discourse/app/serializers/directory_item_serializer.rb:14:in `time_read'
إعجاب واحد (1)

Can’t repro.

Did how exactly you deleted the user?

delete all posts, delete user. I had created a handful of users and posted and deleted them all fine, strictly through UI, etc. Only thing that stands out is that one topic was created while I was impersonating another user.

Is there anything I can do to manually clean it up?

I think this is somehow related to the batch that updates this page didn’t ran after the delete. Gotta repro yet, tough.

I haven’t touched anything but I guess some job ran eventually and now it is okay and works fine, hmm

3 إعجابات