You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/05/23 05:53:09 UTC

[GitHub] [apisix-dashboard] bisakhmondal commented on a change in pull request #1898: feat: additional flag to force start manager-api

bisakhmondal commented on a change in pull request #1898:
URL: https://github.com/apache/apisix-dashboard/pull/1898#discussion_r637491724



##########
File path: api/internal/utils/pid.go
##########
@@ -25,9 +25,13 @@ import (
 )
 
 // WritePID write pid to the given file path.
-func WritePID(filepath string) error {
-	if _, err := os.Stat(filepath); err == nil {
-		return fmt.Errorf("instance of Manager API already running: a pid file exists in %s", filepath)
+func WritePID(filepath string, forceStart bool) error {
+	if pid, err := ReadPID(filepath); err == nil {
+		if !forceStart {
+			return fmt.Errorf("instance of Manager API already running: a pid file exists in %s", filepath)
+		} else {
+			fmt.Printf("force starting new instance. another instance of Manager API is already running with pid %d\n", pid)

Review comment:
       sorry for the late reply. Yeah kinda makes sense though. If due to some reason the pid file cleanup didn't take place which is obviously very unlikely. Yet `maybe` sounds good.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org