Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all!
I made a fix for this outstanding issue:
#290
Requirement: Prevent turnitintooltwo cron task from creating multiple connections if the turnitin server is not responding.
Solution: throwing an error/exception and stopping the task execution
Implementation: using the built-in exceptions handling of the turnitintooltwo plugin (turnitintooltwo_comms::handle_exceptions) to minimise the impact of the fix.
This will ensure the task is not proceeding further if the turntin server is not responding (in 120s) and that no performance is lost due to the multiple connection attempts and just one unsuccessful attempt to connect to the Turnitin server will stop the cron task execution.
Also, this way, multiple occurrences of the error will additionally delay the task execution by the Moodle cron system (see https://docs.moodle.org/dev/Task_API#Failures for more info).
No changes to the actual cron task have been made, this means that it will fail the same way it does so far, just not affecting the performance of the website.
Happy coding!
Cheers,
Johnny