From 51f7297e1d07ecfb06759cec2be4d9f33b33f51a Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 20 Apr 2023 14:03:55 +0200 Subject: [PATCH 1/3] feat(IParallelAwareJob): Document setAllowParallelRuns Signed-off-by: Marcel Klehr --- developer_manual/basics/backgroundjobs.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/developer_manual/basics/backgroundjobs.rst b/developer_manual/basics/backgroundjobs.rst index 3cfdb9369..8b8dd4e2a 100644 --- a/developer_manual/basics/backgroundjobs.rst +++ b/developer_manual/basics/backgroundjobs.rst @@ -85,6 +85,18 @@ or similar things, consider flagging it as time insensitive in the constructor. This allows the Nextcloud to delay the job until a given nightly time window so the users are not that impacted by the heavy load of the background job. +Configuring parallelism +^^^^^^^^^^^^^^^^^^^^^^^ + +With resource-heavy background jobs that run for longer than a few minutes, be they ``QueuedJob`` and ``TimedJob`` instances, you may want to restrict parallelism to prevent multiple such jobs from clogging up your machine's resources. You can do this with the ``setAllowParallelRuns`` method of ``OCP\BackgroundJob\Job`` (``QueuedJob`` and ``TimedJob`` both inherit from this class, so they also have this available). + +.. code-block:: php + + setAllowParallelRuns(false); + Registering a background job ---------------------------- From 0ccf7e4ed6ff0bc99165a1a29a038d1cc81f2894 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 20 Apr 2023 15:19:22 +0200 Subject: [PATCH 2/3] Update developer_manual/basics/backgroundjobs.rst Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com> Signed-off-by: Marcel Klehr --- developer_manual/basics/backgroundjobs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/developer_manual/basics/backgroundjobs.rst b/developer_manual/basics/backgroundjobs.rst index 8b8dd4e2a..22e27f4f9 100644 --- a/developer_manual/basics/backgroundjobs.rst +++ b/developer_manual/basics/backgroundjobs.rst @@ -88,7 +88,7 @@ are not that impacted by the heavy load of the background job. Configuring parallelism ^^^^^^^^^^^^^^^^^^^^^^^ -With resource-heavy background jobs that run for longer than a few minutes, be they ``QueuedJob`` and ``TimedJob`` instances, you may want to restrict parallelism to prevent multiple such jobs from clogging up your machine's resources. You can do this with the ``setAllowParallelRuns`` method of ``OCP\BackgroundJob\Job`` (``QueuedJob`` and ``TimedJob`` both inherit from this class, so they also have this available). +With resource-heavy background jobs that run for longer than a few minutes, be they ``QueuedJob`` and ``TimedJob`` instances, you may want to restrict parallelism to prevent multiple such jobs from clogging up the server's resources. You can do this with the ``setAllowParallelRuns`` method of ``OCP\BackgroundJob\Job`` (``QueuedJob`` and ``TimedJob`` both inherit from this class, so they also have this available). .. code-block:: php From 2c4a751317fcb0b0da93f83918d39612b934feb9 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 20 Apr 2023 15:20:21 +0200 Subject: [PATCH 3/3] feat(IParallelAwareJob): Add versionadded Signed-off-by: Marcel Klehr --- developer_manual/basics/backgroundjobs.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/developer_manual/basics/backgroundjobs.rst b/developer_manual/basics/backgroundjobs.rst index 22e27f4f9..bae3e5a26 100644 --- a/developer_manual/basics/backgroundjobs.rst +++ b/developer_manual/basics/backgroundjobs.rst @@ -88,6 +88,8 @@ are not that impacted by the heavy load of the background job. Configuring parallelism ^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 27 + With resource-heavy background jobs that run for longer than a few minutes, be they ``QueuedJob`` and ``TimedJob`` instances, you may want to restrict parallelism to prevent multiple such jobs from clogging up the server's resources. You can do this with the ``setAllowParallelRuns`` method of ``OCP\BackgroundJob\Job`` (``QueuedJob`` and ``TimedJob`` both inherit from this class, so they also have this available). .. code-block:: php