One issue I've run into is that the video_upload method of attaining sync is to run in the background on a cron. The problem with this is that most syncs require a node_save in order to update the local status of a video.

The problem, then, is that if a cron runs while the user has a node open for editing, the video_upload node_save will cause the user's open edit page to fail validation. It seems to me that the best method toward solving this problem would be to utilize the Content Lock module, and check for a lock before performing a node_save. If the node is locked the video record will remain as-is, and should be triggered the at the next cron.

I'm wondering if there are any other methods people can think of? Is there a native Drupal mechanism for identifying nodes that are open for editing?

If I do add the Content Lock logic I would make it conditional upon that module existing...

CommentFileSizeAuthor
#2 content_lock.patch942 bytesbojanz

Comments

bojanz’s picture

No way to do this in Drupal itself at the moment.

When the node edit form has been submitted, the validator checks if the $node->created value from the DB is the same as the $node->created value from the submitted form. That's how it works.

content_lock sounds like a good solution. Shouldn't be a required dependency though.
Talked to jhedstrom, on IRC:

jhedstrom: I wonder how often that really happens...seems like quite an edge case, and I'm reluctant to add a new dependency
bojanz: yeah, me too. Perhaps having some code that uses content_lock if enabled, and a line in README would make everyone happy
jhedstrom: that sounds good to me

bojanz’s picture

Status: Active » Needs work
StatusFileSize
new942 bytes

Here's mshick's patch.

However, I'm not sure this is enough. Sure, if the node is locked, we ignore it. However, what if the video was uploading to the provider? Next time cron runs, it gets reuploaded again, giving us duplicates.