Post-receive script terminated after 54 seconds

Context

After setting up a post-receive script I have noticed it is consistently terminated after 54 seconds. post-receive script:

#!/bin/bash
echo "Started post-receive script" > "post_receive_log.txt"
for i in {1..120}
do
	echo "Running for $i seconds" >> "post_receive_log.txt"
	sleep 1
done

This outputs:

Running for 1 seconds
Running for 2 seconds
.
.
Running for 53 seconds
Running for 54 seconds

And stops at 54, instead of 119. Additionally, the GitLab server throws error: 4:Deadline Exceeded. as displayed:

Attempts

Since I would like the post-receive script to run at least for 10 minutes, I tried increasing the worker limits in the /etc/gitlab/gitlab.rb file. In particular, I tried (independently and combined), to add the following changes:

gitlab_rails['max_request_duration_seconds'] = 570
gitlab_rails['env'] = {
   'GITLAB_RAILS_RACK_TIMEOUT' => 600
 }
gitlab_rails['application_settings_cache_seconds'] = 600
puma['worker_timeout'] = 600

Followed by a:

gitlab-ctl reconfigure
gitlab-ctl restart

However, the post-receive script is still being cut off after 54 seconds.

Question

How can I allow the post-receive script to run for e.g. 2000 seconds?