Advertisement:

Author Topic: rc2 alerts not showing up initially?  (Read 782 times)

Offline m4z

  • Jr. Member
  • **
  • Posts: 149
rc2 alerts not showing up initially?
« on: April 16, 2019, 05:41:04 PM »
I've seen quite a few issues related to Alerts for 2.1rc2, but mine didn't exactly match any of those I found.

In my test forum, I created an additional "normal user" account (named Bob) for testing purposes and did some things 3 days back. One of them was quoting one of my "own", main (admin) account, posts.
Now, three days later, long logged back in as my admin account (named m4z), I just clicked around my forum, and for the first time clicked on "Alerts". Before I clicked, no alerts were shown, but once I clicked, the encircled number 1 and alert (shown in the attached screenshot) appeared.

My account is not configured to "Follow topics I create and reply to", and is configured to "receive alerts [...] When a post of mine is quoted (when I'm not already watching that topic)", and I'm not watching any topic (or board).
The forum is configured to "Allow AJAX Desktop Notifications for Alerts".

There are no entries in the error log related to this issue (those visible in the screenshots are a couple of days old).
"Faith is what you have in things that don't exist."
--Homer Simpson

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,216
    • StoryBB/StoryBB on GitHub
Re: rc2 alerts not showing up initially?
« Reply #1 on: April 16, 2019, 05:45:53 PM »
The alerts only get triggered when the cron task runs and if you weren’t on the site (and it sounds like it’s not a public site), it wouldn’t get triggered.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline m4z

  • Jr. Member
  • **
  • Posts: 149
Re: rc2 alerts not showing up initially?
« Reply #2 on: April 16, 2019, 05:51:23 PM »
The alerts only get triggered when the cron task runs

Are these the Scheduled Tasks in the Admin interface, or something outside the forum?

and if you weren’t on the site (and it sounds like it’s not a public site), it wouldn’t get triggered.

It's not a public site; I've been on the site numerous times in the last three days (with the (un)altered account). I don't understand how the two are connected, though.
"Faith is what you have in things that don't exist."
--Homer Simpson

Offline SychO

  • Lead Customizer
  • SMF Hero
  • *
  • Posts: 1,401
  • Gender: Male
    • SychO9 on GitHub
    • SychO
Re: rc2 alerts not showing up initially?
« Reply #3 on: April 16, 2019, 05:52:32 PM »
The alerts only get triggered when the cron task runs and if you weren’t on the site (and it sounds like it’s not a public site), it wouldn’t get triggered.

What if he was on the site for quiet a long time ? is that normal behavior ?

because I noticed as well that I'd be browsing for a long time, but then I'd only see alerts when I open the alert popup

Imazighen

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,216
    • StoryBB/StoryBB on GitHub
Re: rc2 alerts not showing up initially?
« Reply #4 on: April 16, 2019, 05:55:51 PM »
The alerts only get triggered when the cron task runs and if you weren’t on the site (and it sounds like it’s not a public site), it wouldn’t get triggered.

What if he was on the site for quiet a long time ? is that normal behavior ?

because I noticed as well that I'd be browsing for a long time, but then I'd only see alerts when I open the alert popup

Yes, this is normal. You have to browse the site to trigger the background tasks.

@m4z these are adhoc tasks queued up in the background_tasks table.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline SychO

  • Lead Customizer
  • SMF Hero
  • *
  • Posts: 1,401
  • Gender: Male
    • SychO9 on GitHub
    • SychO
Re: rc2 alerts not showing up initially?
« Reply #5 on: April 16, 2019, 06:01:26 PM »
To be precise when a "mention" background task is triggered and the alert is sitting in the smf_user_alerts table, the alert count remains empty and only increments once the popup is clicked, that's gotta be a bug though right ?

Imazighen

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,216
    • StoryBB/StoryBB on GitHub
Re: rc2 alerts not showing up initially?
« Reply #6 on: April 16, 2019, 06:03:27 PM »
To be precise that’s not what I said.

You make a post with a mention, in that page load an item goes on the queue. The next page load will trigger a third page load in the background to clear the queue. That, and not before, is when the alerts count will change.

So, no, not a bug, working as designed.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline m4z

  • Jr. Member
  • **
  • Posts: 149
Re: rc2 alerts not showing up initially?
« Reply #7 on: April 16, 2019, 06:04:25 PM »
Yes, this is normal. You have to browse the site to trigger the background tasks.

@m4z these are adhoc tasks queued up in the background_tasks table.

So there has to be non-negligible traffic for them to be run?

Don't know if they ever ran, I can't tell:
Code: [Select]
beta-smf=> select * from betasmf_background_tasks;
 id_task | task_file | task_class | task_data | claimed_time
---------+-----------+------------+-----------+--------------
(0 rows)

beta-smf=> select * from betasmf_background_tasks_seq ;
        sequence_name         | last_value | start_value | increment_by |      max_value      | min_value | cache_value | log_cnt | is_cycled | is_called
------------------------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 betasmf_background_tasks_seq |         65 |           1 |            1 | 9223372036854775807 |         1 |           1 |      32 | f         | t
(1 row)

beta-smf=>

Does this mean it ran 65 times?

To be precise when a "mention" background task is triggered and the alert is sitting in the smf_user_alerts table, the alert count remains empty and only increments once the popup is clicked, that's gotta be a bug though right ?

Mentions are disabled in my forum, does that matter?
"Faith is what you have in things that don't exist."
--Homer Simpson

Offline m4z

  • Jr. Member
  • **
  • Posts: 149
Re: rc2 alerts not showing up initially?
« Reply #8 on: April 16, 2019, 06:05:49 PM »
You make a post with a mention, in that page load an item goes on the queue. The next page load will trigger a third page load in the background to clear the queue. That, and not before, is when the alerts count will change.

So, no, not a bug, working as designed.

I've browsed the site dozens, if not hundreds of times over the last three days.
"Faith is what you have in things that don't exist."
--Homer Simpson

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,216
    • StoryBB/StoryBB on GitHub
Re: rc2 alerts not showing up initially?
« Reply #9 on: April 16, 2019, 06:08:02 PM »
There has to be *some* traffic. The way you described it there was *no* traffic.

That dump suggests that a total of 65 tasks have been run. But even if mentions are disabled, the “notify people on new post” task still gets generated and run so it’s not done in a way that slows down the general user experience.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline SychO

  • Lead Customizer
  • SMF Hero
  • *
  • Posts: 1,401
  • Gender: Male
    • SychO9 on GitHub
    • SychO
Re: rc2 alerts not showing up initially?
« Reply #10 on: April 16, 2019, 06:13:54 PM »
To be precise that’s not what I said.

You make a post with a mention, in that page load an item goes on the queue. The next page load will trigger a third page load in the background to clear the queue. That, and not before, is when the alerts count will change.

So, no, not a bug, working as designed.

Yes I understand that, but what I described isn't how I think it works, it's how it is working with some alerts like the "mentions" as I am testing right now,

when the queue is cleared and the alert is successfully added to the user_alerts table, the count should be going up, but it isn't, and won't unless you open the popup. Just wanted to ask you if this current behavior is something to fix

Imazighen

Offline m4z

  • Jr. Member
  • **
  • Posts: 149
Re: rc2 alerts not showing up initially?
« Reply #11 on: April 16, 2019, 06:19:26 PM »
There has to be *some* traffic. The way you described it there was *no* traffic.

Yeah I was only talking about myself in the first post, and very misleadingly so. At least one other user browsed a bit, and I used the site quite a lot in the last few days.

Quote
# grep "1[456]/Apr.\+ /[forumpath]/.\+\.php" /var/log/lighttpd/access.log | wc -l
5403
"Faith is what you have in things that don't exist."
--Homer Simpson

Offline Massl

  • Jr. Member
  • **
  • Posts: 256
Re: rc2 alerts not showing up initially?
« Reply #12 on: April 17, 2019, 02:58:14 AM »
Yes I understand that, but what I described isn't how I think it works, it's how it is working with some alerts like the "mentions" as I am testing right now

Hi, the same thing happens with quote alerts.

Offline SychO

  • Lead Customizer
  • SMF Hero
  • *
  • Posts: 1,401
  • Gender: Male
    • SychO9 on GitHub
    • SychO
Re: rc2 alerts not showing up initially?
« Reply #13 on: April 17, 2019, 08:56:21 AM »
So it turns out that the issue was that updateMemberData() in the post specific alerts and a few other ones was being executed before inserting the new alert(s), and since the function uses alert_count() to get the new "alerts" value to insert it in the database for the specific member,
it wasn't counting the new alert(s) which is why the count never automatically went up and you had to open the popup to re-execute the alet_count() function, I posted a fix on github.

Imazighen

Offline m4z

  • Jr. Member
  • **
  • Posts: 149
Re: rc2 alerts not showing up initially?
« Reply #14 on: April 17, 2019, 10:43:28 AM »
"Faith is what you have in things that don't exist."
--Homer Simpson

Offline Massl

  • Jr. Member
  • **
  • Posts: 256
Re: rc2 alerts not showing up initially?
« Reply #15 on: April 17, 2019, 10:58:12 AM »
Thanks SychO, now is perfect!  ;D