Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
True Asynchronous Cron Jobs using Javascript [!AJAX]. No more hanging page loads. Details »
True Asynchronous Cron Jobs using Javascript [!AJAX]. No more hanging page loads.
Mod Version: 1.0.1, by Analogpoint (Member) Analogpoint is offline
Developer Last Online: Dec 2007 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.6.x Rating: (19 votes - 4.63 average) Installs: 175
Released: 18 Oct 2007 Last Update: 19 Oct 2007 Downloads: 693
Not Supported Uses Plugins  

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.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • If you like this modification support the author by donating.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
  #61  
Old 06 Dec 2007, 23:12
MrNase's Avatar
MrNase MrNase is offline
 
Join Date: May 2003
Real name: Dominik
Does it only attach the plugin code when there is a cron job that needs to be run?
Reply With Quote
  #62  
Old 20 Dec 2007, 21:56
cosy cosy is offline
 
Join Date: Jul 2007
any plans to get this for 3.7 ?
Reply With Quote
  #63  
Old 02 May 2008, 02:47
dashed dashed is offline
 
Join Date: Mar 2006
Does this work for vb 3.7?
Reply With Quote
  #64  
Old 02 May 2008, 14:59
K4GAP K4GAP is offline
 
Join Date: Mar 2008
Waiting for answer to last two posts.... 3.7 ?

Helloooo, anyone there? lol, sorry I get in a hurry sometimes
Reply With Quote
  #65  
Old 03 May 2008, 02:08
Milad's Avatar
Milad Milad is offline
 
Join Date: May 2005
Real name: Milad
I think it works. the developer is absent since 06 Dec 2007
Reply With Quote
  #66  
Old 18 Jun 2008, 18:48
ArnyVee's Avatar
ArnyVee ArnyVee is offline
 
Join Date: Mar 2008
I can't really tell if it's working or not, to tell you the truth

But, I haven't had any issues and I'm running 3.7.1 P1
Reply With Quote
  #67  
Old 18 Jun 2008, 20:38
trilljester's Avatar
trilljester trilljester is offline
 
Join Date: Jul 2005
I'll give this a shot to see if my cron jobs will execute better.

I wish Jelsoft would give us that have actual shell access to our servers the ability to execute the cron jobs from a shell-based cron, rather than PHP-based.
__________________
http://www.trilliummud.com - Wordpress, Drupal and VBulletin. A perfect marriage of open and closed source. Visit us to see them in action together!
Reply With Quote
  #68  
Old 19 Aug 2009, 22:12
Fenriz Fenriz is offline
 
Join Date: Aug 2002
Does it work with vb 3.8.x ?
Reply With Quote
  #69  
Old 16 Sep 2009, 13:30
Jazzi Jazzi is offline
 
Join Date: Feb 2008
Real name: Paul
Working for 3.8.4.
Reply With Quote
  #70  
Old 04 Feb 2012, 21:58
too_cool_3's Avatar
too_cool_3 too_cool_3 is offline
 
Join Date: Sep 2007
Real name: Marc
Does this mod do anything in vB 4 and does it work?
__________________
TBMOTORING - Thunder Bay Automotive Enthusiast Club
http://tbmotoring.com
Reply With Quote
  #71  
Old 13 Jan 2014, 03:48
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Installed on a v3.8.6 and actually also moved the $cronimage call out of the footer template and into the headinclude template.
Reply With Quote
  #72  
Old 13 Jun 2015, 15:40
fxdigi-cash fxdigi-cash is offline
 
Join Date: Jul 2012
works on vb 4.2.2 perfectly! no issues at all. one of the best articles ever! Big Thanks
__________________
Shoot me a PM if I didn't reply in your post when you needed help. I can't remember things easily
Reply With Quote
  #73  
Old 15 Dec 2015, 17:23
pl804 pl804 is offline
 
Join Date: Aug 2015
Do modern browsers still hang when the pixel calls a scheduled task, or has this been resolved by the latest browser versions?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 16:20.

Layout Options | Width: Wide Color: