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/16 10:21:10 UTC

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

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



##########
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:
       `is already` => `maybe` 
   Is this would be better? Since the old manager API maybe is not running.




-- 
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