kaschioudi / ojs3-markup

markup plugin for OJS3
8 stars 15 forks source link

CURL job starting batch conversion has no error checking #47

Closed asmecher closed 6 years ago

asmecher commented 6 years ago

See https://github.com/kaschioudi/ojs3-markup/blob/fd0556c0018b60ae986bce9d06ff622683ebcda2/MarkupBatchConversionHandler.inc.php#L111 -- In a local test, I start a conversion process and receive the "Batch conversion started successfully" notification. However, the process appears to have failed, despite the notification. There needs to be error/response checking on the CURL job.

kaschioudi commented 6 years ago

@asmecher

curl_setopt($ch, CURLOPT_TIMEOUT_MS, 1000); makes the curl request timeout after 1 sec so that this request does not hang waiting for the process behind the gateway plugin to complete.

Because of the timeout set above, curl_exec($ch); will always return an empty string. I don't really see how i could check the curl status here. Please let me know if you know a way.

asmecher commented 6 years ago

The base problem I'd like to try solving is that a user is given a promise that a process has started, when that might not be true. Some common causes:

Currently the process appears to silently dead-end. Users who encounter this will be hard to help remotely.

In my opinion the cleanest way for OTS and OJS to interoperate would be for OJS to submit the conversion list all at once to OTS, when the user hits the button. Then the plugin could accurately report whether the list was properly sent, and OTS could work asynchronously with OJS to work through the list. However, I'm not sure how much work that would require on the OTS side, so it may not be feasible.

Some other ideas for improving this that might be more feasible:

kaschioudi commented 6 years ago

In my opinion the cleanest way for OTS and OJS to interoperate would be for OJS to submit the conversion list all at once to OTS, when the user hits the button.

I don't think OTS API provides the capability to trigger multiple jobs in a single call. Conversions are triggered one by one.

  • Change the notification from "Batch conversion started successfully" to something more accurate, like "Your conversion request is being processed."

Done.

I just added a function to MarkupBatchConversionHelper only to realize that the only place where there could be a fatal error in the process would be when an invalid User ID is provided (https://github.com/kaschioudi/ojs3-markup/blob/45-fix/MarkupBatchGatewayPlugin.inc.php#L155-L157). Then there's no user to send email to.