Your DB is listening on Unix socket and you try to connect to it via TCP. It fails so the application tries to do it again after tha DB connection process is restarted.
You might want to check the file /etc/postgresql/{your_version}/main/postgresql.conf for the configuration key listen_addresses, in your case it might be empty, making it listen only at the unix socket. change it to: listen_addresses = 'localhost' or more broadly accepting from all interfaces of the machine listen_addresses = '*', to include more than one, use commas.
BTW, it is a local server for development or production? And are you starting from command line or using systemd service ? Because you can start postgres listening to an address from the start command like postgres -c listen_addresses='*'