When there is a problem with the feed itself (website down, feed corrupted) and cron runs, there's no indication that a problem occurred. Nothing in the watchdog for example. It would be awesome if there was a way for me to run some code when the feed cannot be refreshed from cron, or at the very least, logging an error using watchdog.

CommentFileSizeAuthor
#2 249866.patch664 bytesroychri

Comments

roychri’s picture

Version: 6.x-1.2 » 5.x-1.2
Status: Active » Needs review

Ooops. Wrong version. This is for 5.x

roychri’s picture

StatusFileSize
new664 bytes

This patch calls watchdog() and creates a new hook called hook_feedapi_error().
So if I want something special to happen on error, I simply have to create

function mymodule_feedapi_error($feed) {
  .... 
}

Since this only fires on error, which should not happen often, the extra overhead of the hook will not slow the application down.

What do you think?

mustafau’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Status: Needs review » Needs work

I think a hook is not necessary. A watchdog call should be enough.

roychri’s picture

Without the hook, how can I have it send me an email when it fails?
That's one of our requirement and I would rather having to avoid changing the code of feedapi for my project.
Since this hook is only run on error, it would not pose any significant performance problems.
Let me know.