Your bosses, because now go is cluster pattern, there are n servers, such implementation timing task only in a stage to perform at the same time, based on web development
CodePudding user response:
There are several solutions 1. Only one server startup time task (the other server does not start timing task) 2. Through the environment variable controls whether to launch timing server (go read the environment variables, only one server environment variable is time service, launch the other server environment variable is not start timing service) 3. If you use the same database, can be controlled by lock table records 4. Similar to 3, don't lock table directly, but to a center service application to perform a task, once a center services have repeated application refuses to perform a task , etc.