Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-14-2012, 01:36 PM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Why not do 1 feed then post at a time rather than save in memory?

Hey,

I wanted my RSS poster to go through each feed one by one, I.e. get the feed, post then go to the next.

I think right now it is all being saved in memory for all feeds at once then posted once complete.

It is causing problems with my hosting timing out or simply too much in the memory, meaning all feeds that have been retrieved are lost and it only picks up the feeds after the last run date.

Is there any other way to run the feeds so it doesnt use so much memory?

Thanks
Reply With Quote
  #2  
Old 11-14-2012, 02:13 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would need to change includes/cron/rssposter.php. It looks like it could be restructured to do one feed at a time and free the memory in between, but if the problem is time then that won't help. Another possibly easier thing to do might be to make a number of copies of rssposter.php, modify the query at the beginning so that it each copy only gets one or more feeds (by filtering on the ids), then set up each file to run as a separate scheduled task at but at different times.
Reply With Quote
  #3  
Old 11-14-2012, 02:47 PM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Good thinking Kevin on doing separate files

It would work easier in the long run to edit the rssposter but I think I would need someone to code that, PHP isn't my thing, I can only fix small errors unfortunately.

Thanks Kevin
Reply With Quote
  #4  
Old 11-14-2012, 02:53 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure if you're asking, but I think it would just be something like this (existing code starts around line 34, I added the part in red):

Code:
// #############################################################################
// slurp all enabled feeds from the database

$feeds_result = $vbulletin->db->query_read("
	SELECT rssfeed.*, rssfeed.options AS rssoptions, user.*, forum.forumid
	FROM " . TABLE_PREFIX . "rssfeed AS rssfeed
	INNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = rssfeed.userid)
	INNER JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = rssfeed.forumid)
	WHERE rssfeed.options & " . $vbulletin->bf_misc_feedoptions['enabled'] . "
           AND rssfeed.rssfeedid IN (1, 2, 3)
");

where of course you'd change the 1, 2, 3 for each file. You'd also want to disable the original rssposter.php task.

I don't have time to set things up to test it, but if you want to try it, I think it should work.
Reply With Quote
  #5  
Old 11-16-2012, 10:31 AM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wasn't asking you to do it, but thank you so much for helping Kevin

I am going to test this today and I will reply here with the results.

Thanks once again Kevin, really appreciate you helping me

--------------- Added [DATE]1353074786[/DATE] at [TIME]1353074786[/TIME] ---------------

Quick question, what would happen if a feed was removed in the admincp but it was still included in the rssposter file?

For example I was checking and I have a few feeds that haven't been updated in a long time (This is for feeds on a personal site) and I removed them in admincp, but haven't removed the reference in the rssposter file - Would it stop or crash anything?

I would really like if vB updated the Rssposter - It is the only thing I have been having major problems with for a few years now as I always use it.
I have been told by my host that I have to upgrade to a VPS just because of the RSS poster because it is using too much memory when running..I can't afford it for a personal site that is just for my own blog feeds..

I was hoping this would be resolved in vb4 and was happy to upgrade just for this, but it also does the same
Reply With Quote
Благодарность от:
CAG CheechDogg
  #6  
Old 11-16-2012, 01:52 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you remove a feed nothing will happen, because the query just says "get every row that matches these feed ids", so if one id doesn't match any row there will just be one less row (feed) to process, and if none match it shouldn't do anything. But it's true that it's a little difficult to manage. I was going for something that would be easy to implement.

Maybe something else could be done to make it a little better, like maybe modifying rssposter to run only the N 'oldest' feeds (in terms of the last run time), then you wouldn't need to worry about feed ids.

As for vB updating the rss poster - I haven't looked to see what it looks like in vb5 (if it's there yet at all), but I believe development on vb4 is finished except for security fixes (I think there's a vb4.2.1 with some minor fixes that will be released some time, but after that it's mostly done).
Reply With Quote
  #7  
Old 11-16-2012, 02:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually what I mentioned above is a better idea and is easier to implement (I guess that's what happens when you think about it for a minute before replying )

Anyway, I think this should work to limit the number of feeds that run each time:

Code:
// #############################################################################
// slurp all enabled feeds from the database

$feeds_result = $vbulletin->db->query_read("
	SELECT rssfeed.*, rssfeed.options AS rssoptions, user.*, forum.forumid
	FROM " . TABLE_PREFIX . "rssfeed AS rssfeed
	INNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = rssfeed.userid)
	INNER JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = rssfeed.forumid)
	WHERE rssfeed.options & " . $vbulletin->bf_misc_feedoptions['enabled'] . "
            ORDER BY lastrun ASC LIMIT 1
");

Now you don't have to make extra copies of rssposter.php, just modify the original. You would want to change it to run much more often, and if you have many feeds you may need to change the "LIMIT 1" to something higher. I guess this method has the disadvantage that you have to make sure that the task runs often enough to handle all your feeds.
Reply With Quote
  #8  
Old 11-16-2012, 02:21 PM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks again Kevin!

Sorry, but I am trying to think of how this will work, for example, say I have 50 feeds (I have been adding a few over the years ) - Would

Code:
ORDER BY lastrun ASC LIMIT 1
run each of the 50 if I set it up as a cron job? (I have got the cron job working now by calling cron.php and just the RSSposter task)

Would this work if 1 of my feeds has 50 posts that haven't been retrieved, post those, then go on to the next feed?

Sorry Kevin, like I said, not very good with PHP, just trying to understand how it would work

Thank you once again!

--------------- Added [DATE]1353079405[/DATE] at [TIME]1353079405[/TIME] ---------------

I forgot to say, the reason for calling the poster by cron was because the site is just for me, so it doesn't get users that would trigger the cronimage to run the cronjob to post feeds
Reply With Quote
  #9  
Old 11-16-2012, 02:36 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by John Diver View Post
Would this work if 1 of my feeds has 50 posts that haven't been retrieved, post those, then go on to the next feed?
What I think it *should* do (without having tested it or knowing exactly what issues you're having), is process one feed every time the task runs (I suppose it will post whatever new items there are, based on the settings in the feed manager). This means if you have 50 feeds the task would need to run 50 times before getting them all. So you could either set the task to run once per minute (and set you cron job as well) and get them over the course of a hour, or increase the LIMIT to do more feeds per run. Of course this will also be affected by the "Check Feed Every..." setting in the feed manager - a feed will only be processed if enough time has passed.

I realize this still isn't the perfect solution you're looking for, but again it's something you can do with a simple edit.
Reply With Quote
  #10  
Old 11-16-2012, 08:30 PM
John Diver John Diver is offline
 
Join Date: Nov 2003
Posts: 329
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is great Kevin, you have really helped Really

I am going to do this on a test forum now to see how it goes.

Once again, many thanks for helping me out Kevin
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 10:02 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04105 seconds
  • Memory Usage 2,262KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete