News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

rc2 alerts not showing up initially?

Started by m4z, April 16, 2019, 05:41:04 PM

Previous topic - Next topic

m4z

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

Es gibt hier im Forum ein deutsches Support-Board!

Arantor

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.

m4z

Quote from: Arantor on April 16, 2019, 05:45:53 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?

Quote from: Arantor on April 16, 2019, 05:45:53 PM
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

Es gibt hier im Forum ein deutsches Support-Board!

SychO

Quote from: Arantor 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.

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
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Arantor

Quote from: SychO on April 16, 2019, 05:52:32 PM
Quote from: Arantor 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.

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.

SychO

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 ?
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Arantor

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.

m4z

Quote from: Arantor on April 16, 2019, 05:55:51 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:
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?

Quote from: SychO 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 ?

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

Es gibt hier im Forum ein deutsches Support-Board!

m4z

Quote from: Arantor on April 16, 2019, 06:03:27 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

Es gibt hier im Forum ein deutsches Support-Board!

Arantor

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.

SychO

Quote from: Arantor 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.

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
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

m4z

Quote from: Arantor on April 16, 2019, 06:08:02 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

Es gibt hier im Forum ein deutsches Support-Board!

Massl

Quote from: SychO on April 16, 2019, 06:13:54 PM
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.

SychO

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.
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

m4z

"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Massl


Advertisement: