My systemd service with type as notify doesn't start when the server goes to stand by starts up again

The first time I set up my systemd service, it works fine.

However, when I restart the server, the systemd service doesn't start, but it remains on activating.

Could someone give any tip of why this is happening?

Unit file:

[Unit]
Description=My App
After=network.service
StopWhenUnneeded=yes

[Service]
Type=notify
NotifyAccess=all
User=ubuntu
Group=ubuntu

WorkingDirectory=/opt/app
KillMode=process
PIDFile=/tmp/app%I.pid
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=app%I
Environment=SOCKET=/tmp/thin-%I.socket
ExecStart=/opt/app/bin/start
ExecReload=/opt/app/bin/reload
ExecStop=/opt/app/bin/stop
Restart=always
LimitNOFILE=10240
CPUQuota=90%

[Install]
WantedBy=app.target

Logs from journalctl -xe:

Nov 10 20:51:35 hostname systemd[1]: [email protected]: Start operation timed out. Terminating.
Nov 10 20:51:35 hostname systemd[1]: [email protected]: Failed with result 'timeout'.
Nov 10 20:51:35 hostname systemd[1]: Failed to start My App.
-- Subject: Unit [email protected] has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit [email protected] has failed.
--
-- The result is RESULT.
Nov 10 20:51:35 hostname systemd[1]: [email protected]: Service hold-off time over, scheduling restart.
Nov 10 20:51:35 hostname systemd[1]: [email protected]: Scheduled restart job, restart counter is at 4.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit [email protected] has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 10 20:51:35 hostname systemd[1]: Stopped My App.
-- Subject: Unit [email protected] has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit [email protected] has finished shutting down.
Nov 10 20:51:35 hostname systemd[1]: Starting My App...
-- Subject: Unit [email protected] has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit [email protected] has begun starting up.

I'm not sure what information I can provide here to help you help me. If I can provide anything, you can ask me in the comments, please.


I found out what was happening.

The App needed more time to start, but systemd was always killing it before it had time to start and notify. It only happens when booting because the App takes more time to start when the system is booting.

So I needed to add a larger TimeoutSec, then it worked fine.