neo4jphp icon indicating copy to clipboard operation
neo4jphp copied to clipboard

async ?

Open stephaneerard opened this issue 13 years ago • 1 comments

Would it be possible to make this lib async using CURL multi ?

This lib might be of help https://github.com/ericmuyser/php-class-curl/blob/master/src/curl.php but there is still a need to run a ->update() in a while loop to gather returns... Which is faked async imo.

Any insight ?

Thanks !

stephaneerard avatar Jan 23 '12 01:01 stephaneerard

I hadn't thought about it. What do you think the API for that might look like?

One thing to keep in mind is that every request will be wrapped in a transaction on the server side. So doing something like saving two nodes and then attaching them in a relationship might be difficult to do this way:

// This happens async
$nodeA->save(function () { ... });
// This happens async
$nodeB->save(function () { ... });
// If either of the first two calls don't return before this one, Bad Things will occur
$nodeA->relateTo($nodeB, 'FOO')->save(function (){ ... });

What problem are you trying to solve? If it's the case of too many server calls, perhaps batches are the way to go? Maybe we could make batches requests (where all the operations occur in the same transaction) async, but not the rest of the library?

I'm interested to hear any thoughts and ideas you have about this.

jadell avatar Jan 23 '12 05:01 jadell