Must resave settings to enable automatic item import via cron

spiffyd - November 6, 2008 - 20:55
Project:Activity Stream
Version:6.x-1.0-rc1
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

I am confirming this bug for 6.x-1.0-beta2

Once in awhile, stream items do not get imported/created automatically upon Cron run. I have to manually go into My Account >> Activity Stream and re-save the Activity Stream settings. Then Cron will properly import the items.

Any one else experience this?

#1

jacobw - March 8, 2009 - 22:51

Yes, I've had the same problem. If an activity stream causes the cron run to "hang" the stream seams to be ignored until it is saved again.

#2

cryptide - March 16, 2009 - 15:56

Same problem here. Any idea's on how to automate the resaving of all my users settings to fix this problem?

#3

spiffyd - March 17, 2009 - 01:23

I don't think a fix is currently available. You just got to re-save once in awhile.

#4

akalsey - March 17, 2009 - 17:07
Status:active» postponed

From a comment to #310564: Activity Stream not updating...

I think this is an issue of Drupal disabling Activity Stream's cron when one of the sub modules takes a long time to fetch it's feed. Saving the feed settings again causes Drupal to re-enable cron.

The solution here is to figure out a way to set a timeout or detect that a sub module is slow and force Drupal to keep the cron in place. Handle these errors inside the module instead of allowing Drupal to do it for us.

There isn't a way to fix this, per se. Drupal is behaving in the way it was designed. Fetching items from a third party API can be slow and trigger Drupal to kill the module's cron job.

You don't need to go in and re-save all the user's information. Just re-saving once for one user should do it.

#5

cryptide - March 18, 2009 - 18:05

@alesky:

Are you sure that if you update just one user it causes all users activity streams to be fixed? The reason i say this is because sometimes certain people's activity streams (or certain services) will stop working while others will still be working. Sometimes it will just be my facebook status messages that stop while my delicious bookmarks keep feeding.

If you do just have to resave one persons settings... any tips on how to setup a cron job or something to automatically do this?

#6

cryptide - March 23, 2009 - 18:46

Re-Saving one users activity settings does not always fix other users stalled feeds. I just did an experiment with it and in some cases it will jumpstart another users feed. But in my latest attempt it didn't restart a specific users feed and i had to go under that specific users activity stream and resave.

Is this problem stemming from my cheap vps hosting or what? (it did this locally on my xampp also)

#7

akalsey - April 13, 2009 - 19:38
Status:postponed» fixed

In 2.x-dev, the module has support for Job Queue. If Job Queue is installed, updates are queued instead of pushed directly through cron. Using Job Queue should solve this issue.

#8

strausvogel - April 15, 2009 - 12:02

Same problem here.
Any fix?

#9

akalsey - April 15, 2009 - 13:27

Please don't post the same issue multiple times. According to your post at #434220: stream update your issue is not the same as this one.

#10

System Message - April 29, 2009 - 13:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#11

soyarma - May 2, 2009 - 06:43
Version:6.x-1.0-beta2» 6.x-1.0-rc1
Status:closed» active

I've been working on this issue for a bit. I noticed it happening awhile back, but knew that saving the entries fixes it, so I ignored it for a bit. As it turns out, what is happening is the activitystream_accounts table is losing entries. I'm not sure why, and I'm even less certain how the edit page for activity stream is showing the entries to be able to save them back to this table, but I'm in the midst of hunting it down.

#12

soyarma - May 2, 2009 - 07:05

I've tracked the issue down.

In the activitystream_save_account function in activitystream.module the first thing the function does is check to see if the $params has anything in it with

if (count($params) == 0) {
return FALSE;
}

However, the keys are always populated in $params. So this never returns false. Unfortunately the next thing the function does is nuke the entries in the activitystream_accounts table. This happens whenever a user's account page is viewed, so that's why most of you have been experiencing this happening seemingly at random.

I haven't looked into what it will take to make sure that they keys don't exist in the $params array when it is empty, but here's a quick and dirty solution

At the very top of the function coment out the code above and add in this new code above it as so:

function activitystream_save_account($module, &$user, $params) {
  $found_params = false;
  foreach ($params as $p) {
    if ($p != '') {
      $found_params = true;
    }
  }
  if (!$found_params) {
    return false;
  }
  /* if (count($params) == 0) {
    return FALSE;
  } */

#13

akalsey - May 16, 2009 - 16:40

Great find!

With your code, empty parameters would not be saved. This means that if someone removes their twitter ID, it won't be deleted from the system.

The proper fix is to check during hook_user and only run the update operation if the category being saved is activitystream. Much like is done during the "form" operation already.

Fixed and in CVS for both the 2.x-dev and 1.0. New 1.x RC coming shortly.

Anyone want to port the fix to D5?

#14

akalsey - May 16, 2009 - 16:47
Status:active» fixed

#15

System Message - May 30, 2009 - 16:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.