4

According to this answer you can use advanced search to find questions that are on hold now. I noticed that that search produce a list of questions marked with [closed] in titles:

closed

But if you open the question its title will be with [on hold]:

on hold

I believe that titles in the search results should also contain [on hold] if question is actually on hold yet.

4

This was a regression introduced in the latest search code update last month. The code determining the status suffix looked like this, spot the bug:

if (post.IsClosed)
{
    if (post.IsMigrated)
        return "[migrated]";
    if (post.IsDuplicate)
        return "[dupicate]";
    if (post.IsClosed)
        return "[closed]";   
    if (post.ClosedDate?.AddDays(settings.DaysToShowOnHoldInsteadOfClosed) > now)
        return "[on hold]";
}

Fix is rolling out in build rev 2017.10.24.27546.


Previously the on hold check was very expensive, as it had to check the post history table to get the last closed date for all the displayed posts. So it was the last check to be performed, and I guess that fact somehow contributed to convincing at least 3 people looking at this piece of code that it was OK.

| improve this answer | |
  • if (post.IsClosed) appears before checking time of closure. What do I get? ;-) – Shadow Wizard Wearing Mask Oct 24 '17 at 12:07
  • 1
    boo... the second check for IsClosed is redundant, as you already check for this on top. :-) – Shadow Wizard Wearing Mask Oct 24 '17 at 12:08
  • @ShadowWizard virtual points on the internet!!1 – m0sa Oct 24 '17 at 12:08
  • Do you have any kind of Code Review before pushing to production? – αλεχολυτ Oct 24 '17 at 13:00
  • @alexolut yup, this went unnoticed through 2 PRs / code reviews, the one introducing the bug was quite big (changing our entire search pipeline), the other one was removing the expensive DB lookup in favor of the new field in the index (which happened after the network-wide reindex) – m0sa Oct 24 '17 at 16:17
  • @m0sa you just made a new bug. Now in my name :) – αλεχολυτ Oct 24 '17 at 16:57
  • 1
    @alexolut status-completed – m0sa Oct 24 '17 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .