Will --stop-grace-period help to like this behavior of a container in docker swarm?

Hello,

I would like to have as a result of this behavior. While I upgrade a service I would like to remove from DNS (hide for access) a container but stop or kill it with delay. It needs to have some time to write data into the database from app cache but don’t receive new data.

May someone prompt me how I can realize such behavior?

Thank in advance.