vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Board Optimization - True Asynchronous Cron Jobs using Javascript [!AJAX]. No more hanging page loads. (https://vborg.vbsupport.ru/showthread.php?t=160514)

Analogpoint 10-17-2007 10:00 PM

True Asynchronous Cron Jobs using Javascript [!AJAX]. No more hanging page loads.
 
How vB's Cron Jobs Work (and the problem with them)
vBulletin has a great, built-in scheduled task system. It relies on an invisible pixel image output on the bottom of the forum pages to run the scheduled tasks (cron jobs). It works like this: When a user visits a page, vB checks to see if there are any pending cron jobs to execute. If there are, the cron image is inserted at the bottom of the page. That image, instead of displaying a real image, actually calls the scheduled task script which first returns the image, then proceeds to execute the scheduled task. This setup can cause the page load to hang, depending on what browser you're using. vB goes to great lengths to send the content-length header, then flush the image data to the browser. This causes some browsers to stop loading the page even though the script isn't finished running (it has to execute the cron job), since the data returned matches the content-length header. However, not all browsers are that smart. Sometimes they sit there with whatever indicator they have spinning, saying the page is still loading, until the scheduled task has finished.

How this product works, and how it fixes the problem
This add-on fixes the problem. How it works:
1. First it checks to see if the user has Javascript enabled. No Javascript means the standard vB cron image is used, so your scheduled tasks keep running.
2. If Javascript is enabled, then a short snippet of Javascript is inserted at the bottom of the page instead of the cron image.
3. What this Javascript does is first wait until the page is completely loaded. After the page is loaded, it ask for the standard vB cron image, which runs your scheduled task. After the image is loaded, it displays it (it's invisible) at the bottom of the page. It's as simple as that.

The advantage of this setup is that the cron image is requested via Javascript after the page is done loading, so that the user doesn't think something is wrong and wonder why the page won't finish loading.

Installation
Import the product XML via the Product Manager. You can enable/disable the product in the JS Cron Image Options group.

Technical Specs
This product adds one plugin which inserts Javascript where the vB cron image used to go. That's it.

History
Version 1.0.0 - Initial Release
Version 1.0.1 - Better compatibility with vBa and other 'portal' scripts. $vbulletin->options['bburl'] is prepended to the cron image URL.

This product doesn't change how cron jobs execute at all, it only requests the cron image (which starts cron job execution) in a different way, so that the user doesn't have forever-loading pages.

If you use this, please click Mark As Installed.

DragonMasterNYC 10-18-2007 04:05 PM

I like it installing now

dazed12 10-18-2007 05:14 PM

i've installed and trying it out. looks nice
thanks

aveon 10-18-2007 06:42 PM

so this speends up our forum or what

Mrdby 10-18-2007 06:48 PM

interesting

DragonMasterNYC 10-18-2007 06:48 PM

Quote:

Originally Posted by aveon (Post 1363263)
so this speends up our forum or what

Yes it does just a little your forums won't stall when a task is being done.

ciprianrpp 10-18-2007 06:49 PM

works pretty..thank you . installed

Mrdby 10-18-2007 06:51 PM

installed

aveon 10-18-2007 06:56 PM

yea installed and works fine thanx

TTG 10-18-2007 07:17 PM

Excellent addition .. thanks Analogpoint

Clicked install :up:

Milad 10-18-2007 08:13 PM

Very good.

But, will be there a conflict with the <body onload="bla bla bla">?

Is it compatible with all browsers? especially IE6-7 FF1.5 FF2.

Mrdby 10-18-2007 08:45 PM

When i refresh using Mozilla..it gives me a grey screen and then goes back to normal.Why is that?

PoetJA-1975 10-18-2007 11:40 PM

Interesting share = Thanx ;)

Jacquii.

Lizard King 10-19-2007 02:29 AM

<a href="https://vborg.vbsupport.ru/showthread.php?t=123719" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=123719</a>

Analogpoint 10-19-2007 03:23 AM

Quote:

Originally Posted by Milad (Post 1363324)
Very good.

But, will be there a conflict with the <body onload="bla bla bla">?

No.

Quote:

Originally Posted by Milad (Post 1363324)
Is it compatible with all browsers? especially IE6-7 FF1.5 FF2.

Yes.

Quote:

Originally Posted by Mrdby (Post 1363340)
When i refresh using Mozilla..it gives me a grey screen and then goes back to normal.Why is that?

This doesn't affect the display of your forums layout in any way.

Quote:

Originally Posted by Lizard King (Post 1363488)

That's a classic case of using a bulldozer to knock over a molehill. You have to upload a Javascript file, and a php file, as well as install the product. It uses AJAX where AJAX is not needed. It makes you run a hacked version of vB's cron.php file. It doesn't work with vBadvanced, vBdruapal and others. I'm not sure how it deals with users who don't have Javascript enabled. This mod has none of those problems. Shall I continue?

PoetJA-1975 10-19-2007 06:43 AM

was waiting for the above statement to install :)
Thanx for the share!

Jacquii.

succo 10-19-2007 08:33 AM

ehm... to make it work under vbadvanced (i mean, the portal) i had to subst cron.php in the plugin with the full path to cron, or it was searching for cron in the root folder, obviously not finding it :)

btw, yes, this seems to speed up loading very much, thanks!

Mecho 10-19-2007 09:59 AM

would u plz someone explain how we should kno that it works or not ?? i mean where we can find any detail that how it works in our board and ... !!

thanks

Analogpoint 10-19-2007 02:02 PM

Quote:

Originally Posted by succo (Post 1363615)
ehm... to make it work under vbadvanced (i mean, the portal) i had to subst cron.php in the plugin with the full path to cron, or it was searching for cron in the root folder, obviously not finding it :)

btw, yes, this seems to speed up loading very much, thanks!

It has the same behaviour as the default vB cron image, which also wouldn't be inserted into vBa pages.

Quote:

Originally Posted by Mecho (Post 1363646)
would u plz someone explain how we should kno that it works or not ?? i mean where we can find any detail that how it works in our board and ... !!

thanks

View your cron log and see if the scheduled tasks are being run. :)

Analogpoint 10-19-2007 02:33 PM

Quote:

Originally Posted by succo (Post 1363615)
ehm... to make it work under vbadvanced (i mean, the portal) i had to subst cron.php in the plugin with the full path to cron, or it was searching for cron in the root folder, obviously not finding it :)

btw, yes, this seems to speed up loading very much, thanks!

I've updated the product (version 1.0.1) to use $vbulletin->options['bburl'] so that it will have better out-of-the-box compatibility with vBa and other portal scripts. If you're not using a portal script, there's no reason to update, but it also won't hurt anything if you do update. :)

DragonMasterNYC 10-19-2007 03:25 PM

I'll see how this update is when I install MK portal even though its not completely integrated with vBulletin.

almqdad 10-19-2007 07:05 PM

THANKS Analogpoint

GReAT HACK

Mrdby 10-19-2007 07:35 PM

Quote:

Originally Posted by Analogpoint (Post 1363505)
No.


Yes.


This doesn't affect the display of your forums layout in any way.



That's a classic case of using a bulldozer to knock over a molehill. You have to upload a Javascript file, and a php file, as well as install the product. It uses AJAX where AJAX is not needed. It makes you run a hacked version of vB's cron.php file. It doesn't work with vBadvanced, vBdruapal and others. I'm not sure how it deals with users who don't have Javascript enabled. This mod has none of those problems. Shall I continue?

lmao get em

iogames 10-19-2007 07:37 PM

Time has teach me to wait for the second version :D
Great-must install!

Analogpoint 10-19-2007 07:49 PM

Quote:

Originally Posted by DragonMasterNYC (Post 1363793)
I'll see how this update is when I install MK portal even though its not completely integrated with vBulletin.

Great! Post back here and let us know how it worked.

Quote:

Originally Posted by Mrdby (Post 1363901)
lmao get em

:) Actually I wasn't intending to attack the authors of the other mod. They have a valid way of doing it. I just think this mod accomplishes the same thing (Asynchronous Cron Jobs) in a *lot* simpler and less error-prone fashion.

Saviour 10-20-2007 12:28 AM

Noticeable improvement on page loading time. Much appreciated! Marked Installed...

Kihon Kata 10-20-2007 02:08 AM

What? I only see a XML to import, no files.

Quote:

Originally Posted by Analogpoint (Post 1363505)
You have to upload a Javascript file, and a php file, as well as install the product.


Analogpoint 10-20-2007 04:18 AM

Quote:

Originally Posted by Kihon Kata (Post 1364073)
What? I only see a XML to import, no files.

That's right, for this product, all you have to do is import the XML file.

BobbyBig 10-20-2007 10:47 AM

How about including what browsers do problems..

Mecho 10-20-2007 12:37 PM

Quote:

Originally Posted by Analogpoint (Post 1363740)
View your cron log and see if the scheduled tasks are being run. :)

i searched everywhere but i couldnt find anything ! would u plz tell me where exactly i have to look ?

p.s. JS Cron Image Options is Enabled

Thanks

Tulsa 10-20-2007 01:01 PM

Quote:

Originally Posted by Mecho (Post 1364323)
i searched everywhere but i couldnt find anything ! would u plz tell me where exactly i have to look ?

p.s. JS Cron Image Options is Enabled

Thanks

Admincp > Statistics & Logs > Scheduled Task Log

You can view any of all of your cron jobs

Analogpoint 10-20-2007 01:03 PM

Quote:

Originally Posted by BobbyBig (Post 1364274)
How about including what browsers do problems..

I tested it in IE6, IE7, FF2, Opera9. It should work in *any* browser that runs Javascript. And remember, if Javascript is not available, it reverts back to the standard vB cronimage so your scheduled tasks continue to run.

Quote:

Originally Posted by Mecho (Post 1364323)
i searched everywhere but i couldnt find anything ! would u plz tell me where exactly i have to look ?

p.s. JS Cron Image Options is Enabled

Thanks

Admin Control Panel -> Scheduled Tasks (near the bottom) -> Scheduled Task Log.

Kihon Kata 10-20-2007 01:04 PM

Hey, Analog, How do we know it's working?

Mecho 10-20-2007 01:58 PM

Quote:

Originally Posted by Analogpoint (Post 1364334)
Admin Control Panel -> Scheduled Tasks (near the bottom) -> Scheduled Task Log.

Thanks but i dunno y i can not see any log for this cron !!

Analogpoint 10-20-2007 02:18 PM

Quote:

Originally Posted by Kihon Kata (Post 1364338)
Hey, Analog, How do we know it's working?

Check your logs.

Admin Control Panel -> Scheduled Tasks (near the bottom) -> Scheduled Task Log.


Quote:

Originally Posted by Mecho (Post 1364363)
Thanks but i dunno y i can not see any log for this cron !!

Are there any logs for scheduled tasks from before installing this product? Do you have any scheduled tasks set up and enabled? Have you had any forum visitors? (if you don't your scheduled tasks won't run)

I'll reiterate. This mod doesn't change how scheduled task run. It only changes how the cronimage is loaded into the footer of the site.

Mecho 10-23-2007 01:14 PM

yea i have many scheduled logs ! but i can not see any log for this mod in LOGS :(

Analogpoint 10-23-2007 05:41 PM

Quote:

Originally Posted by Mecho (Post 1366731)
yea i have many scheduled logs ! but i can not see any log for this mod in LOGS :(

There's no log for this mod. If your regular scheduled tasks are running, then this mod is doing it's job. This mod simply runs all your regular scheduled tasks, it just works better than the default vB cronimage.

Mecho 10-24-2007 11:59 AM

today i check the scheduled tasks and i saw the times r for 4 days before !! and next time running time was for 3days before !!
any idea ???

Analogpoint 10-24-2007 07:54 PM

Quote:

Originally Posted by Mecho (Post 1367411)
today i check the scheduled tasks and i saw the times r for 4 days before !! and next time running time was for 3days before !!
any idea ???

If you don't have any forum visitors the scheduled tasks can't run. If you want to test it, disable this product, and the scheduled task log will look exactly like it does with it enabled.

andrewy3k 10-28-2007 04:55 AM

I have a question.. is there any way to really tell if this actually improves loading times?.. Anyone actually test to see? And is it a more efficient hack for big boards?

thanks ahead of time


All times are GMT. The time now is 06:21 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01869 seconds
  • Memory Usage 1,828KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (22)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete