Problem/Motivation

Currently the cron processes the purge of remote entities during cron.
It would be nice if entites that are marked with "needs remote save" would be processed as well. This way we can implement something like an asynchronous saving.

Proposed resolution

Add a item in remote_entity_cron_queue_info() and fill this queue in remote_entity_cron().
Btw. in the patch I've added calls to deleteQueue() before building the queue in remote_entity_cron() - this should avoid having duplicated entries / double processing in the queue,

Remaining tasks

Reviews needed.

User interface changes

None.

API changes

None.

Comments

joachim’s picture

Status: Needs review » Needs work

Yup, definitely a good idea.

On my project this was handled at the custom module layer, as we were making use of the multiple save functionality in Microsoft Dynamics. Hence I never got round to writing the generic case :(

  1. +++ b/remote_entity.module
    @@ -269,6 +274,25 @@ function remote_entity_cron() {
    +    // Queue items to be remote re-saved.
    ...
    +        ->propertyCondition('needs_remote_save', REMOTE_ENTITY_REMOTE_SAVE_NEEDED)
    

    Comment and code don't agree.

  2. +++ b/remote_entity.module
    @@ -309,6 +336,18 @@ function remote_entity_cron_queue_entity_delete($queue_item) {
    +function remote_entity_cron_queue_entity_remote_resave($queue_item) {
    

    Can we change the name of this callback? It would serve just as well for users that want to queue for regular remote save.

Finally, I think it would be better if this were optional, same as the purging.

das-peter’s picture

Title: Process "need remote save" entities on cron. » Process "need remote save" entities on cron & add drush integration.
StatusFileSize
new32.66 KB

Patch became bigger than expected.
What it adds now:

  • Unified creation of batches:
    remote_entity_purge_batch_create()
    remote_entity_resave_batch_create()
  • Drush integration - uses the batch creation functions:
    drush remote-entity-purge my_remote_entity your_remote_entity
    drush remote-entity-resave --save-failed --save-needed my_remote_entity your_remote_entity
  • Updated admin UI
    • Report view provides action checkboxes - uses the batch creation functions.
    • Resource configuration provides checkboxes to configure cron tasks.
  • New function to fetch remote entity types remote_entity_get_remote_entity_types()
das-peter’s picture

Status: Needs work » Needs review

Oh yeah, reviews would be nice - changing status :)