Plugin Author
alxuta
(@alxuta)
Did you set that cronjob?
There’s a cronjob that will automatically remove the old sessions.
Thread Starter
Chris
(@weazel91)
Hi,
Yes, there is a cronjob set for every one minute (* * * * *) and this functions as intended.
It is rather odd as seems to be very intermittent as to when it happens. When the “Active Sessions” goes out of order with the sessions in the Sessions table it never ever fixes itself. I.e. if I manually (just to break it – as that is what happened before) set the active in the database to 5, it will always remain at 5 even although the status in the sessions table may only have 3 row of people in it with 2 sessions set to “1”.
But trying to make the active sessions show more than what it should be is a hit or a miss. I’ll see if I can delve in a bit more today and see what makes it go wrong.
Thanks for your prompt reply.
Plugin Author
alxuta
(@alxuta)
I see,
It will help me if you could replicate the error.
I’ll also have a look and see if that part can be improved, and make it fix itself in case of error or bad synchronization between active sessions and pending.
Thread Starter
Chris
(@weazel91)
Perfect thanks. Will get on it soon and have another play again.
Thanks again for the plugin, I’ve been looking for something like this for quite a while! I’m more than happy to donate something to further the advancement of this plugin if you accept donations.
Thanks,
Chris
Thread Starter
Chris
(@weazel91)
Hi again,
So a clean reinstall and 4 separate devices straight away produced this:
https://pasteboard.co/J5JjHW4.png
And i’m not sure why?
After the Cron re-runs I get this:
https://pasteboard.co/J5Jk39y.png
I believe this is how I ended up with too many active sessions. Not sure why pending would delve into minus?
Thanks,
Chris
Plugin Author
alxuta
(@alxuta)
Can you please share a screenshot with the options/settings page?
Thread Starter
Chris
(@weazel91)
Hi,
Attached.
https://pasteboard.co/J5JnerX.png
EDIT:
After settling down my active is at 1 and pending at 0.
Chris
Plugin Author
alxuta
(@alxuta)
I see.
I’ll have a look later tonight.
Plugin Author
alxuta
(@alxuta)
@weazel91 could you please update the plugin and do a test?
I just did a test with 250 virtual users and it passed my test.
Thank you,
Alex
Thread Starter
Chris
(@weazel91)
Hi Alex!
Perfect! I believe the Active and Pending counters are working correctly now, I haven’t even seen a minus figure either.
One other thing I noticed:
I believe (tried 3 times and I THINK it is the case, you may wish to confirm) that if the max number of users hits the MAX set in Header Options (i.e. 4 users with 4 set in settings) that when the cron runs and it finds someone has left the site it wont let the next person at the front of the queue in, even although there is now a space available. It will wait until another person has left the site so there is only 2 people live on the site. Cron runs, and it will then let the person at the top of the queue in on refresh. Therefore only 3 people in at any one time rather than the 4 allowed. This is reflected in the Active / Pending in statistics. Active will never hit 4 again.
Also can I request the following be added to virtual-queue.php
Line 106:
function vq_shortcode_total() {
global $wpdb;
$table = $wpdb->prefix . 'vq_sessions';
$undefined = '#pending';
$totalqueue = $wpdb->get_var( "SELECT COUNT(*) FROM $table where status=0" );
if ( $totalqueue ):
return $totalqueue;
else:
return $undefined;
endif;
}
and this at new line 120
add_shortcode( 'virtual-queue-total', 'vq_shortcode_total' );
I just believe it would be handy for people to see what position they are at in the whole queue, or at least give the option for people to add that shortcode.
Also can I also request line 97 have the ‘- 1’ removed as with myself being 0 in the queue would make me think I should be on the site. I don’t mind being 1st in the queue, the page refreshing and I am in.
I hope you don’t mind me requesting the changes? What you have done though is incredible, so Kudos!
Thanks again,
Chris
Plugin Author
alxuta
(@alxuta)
Hi Chris,
I don’t mind at all :). I’m quite happy with someone doing a bit of testing and giving some great ideas!
I’ll check everything you said and add that extra shortcode.
Alex
Thread Starter
Chris
(@weazel91)
Great! You’re welcome. Look forward to your next release.
Chris
Plugin Author
alxuta
(@alxuta)
New update:
-1 = removed
shortcode = added (with a small update, see if that will work for you)
I’ll check the cronJob logic again tomorrow.
If you have any other ideas, please let me know.
Thread Starter
Chris
(@weazel91)
Hi Alex,
New update works amazingly, new shortcode is such a help too! And the edit php makes total sense!
Thanks for checking that other bug above. It’s small in the grand scheme of things but if you are only allowing a small handful of people to the site for any reason then it may be more of an issue.
Other ideas which may be of use are below:
* Record user IP in sessions table (Helpful to aid in some diagnosis)
* Show edited version of Sessions table under statistics tab in wp-admin with suitably edited fields (i.e. ID – IP Address – Queue Position – Has been Waiting (time) – Active/Waiting)
* Create in the above table ‘SKIP QUEUE’ button (Useful for companies that will have telephone support, namely ours, and may require to PUSH people up the queue to access straight away) This could pose an issue for cron logic the way it is, namely too many people above the sessions_limit_number. Not sure how that would cope?
* A way to display to the user an ETA to the site, again via the use of a shortcode. I can’t think how this would work in my head at the moment (blame it being before 9am!) but if it could somehow use previously calculated wait times and display to waiting users using their position perhaps… that might be a long shot and not sure how accurate that would be… it may not be worth it in the long shot?
The above is just a few ideas that would be helpful in scenarios that I find our charity in at times.
Thanks,
Chris