버전 비교 로직 제거
This commit is contained in:
@ -131,26 +131,37 @@ func unmarshal[T any](val *T, src map[string]string) {
|
||||
logger.Println("operation receive :", argval.Elem().Type().Name(), *val)
|
||||
}
|
||||
|
||||
func gatherDeployedPrograms(storageRoot, name string) []*protos.VersionAndArgs {
|
||||
var rawvers []*protos.VersionAndArgs
|
||||
type version_args_ts struct {
|
||||
*protos.VersionAndArgs
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func gatherDeployedPrograms(storageRoot, name string) (out []*protos.VersionAndArgs) {
|
||||
var rawvers []version_args_ts
|
||||
targetPath := path.Join(storageRoot, name)
|
||||
if vers, err := os.ReadDir(targetPath); err == nil {
|
||||
for _, ver := range vers {
|
||||
if ver.IsDir() {
|
||||
fi, _ := ver.Info()
|
||||
args := lastExecutionArgs(path.Join(targetPath, ver.Name()))
|
||||
rawvers = append(rawvers, &protos.VersionAndArgs{
|
||||
Version: ver.Name(),
|
||||
Args: args,
|
||||
rawvers = append(rawvers, version_args_ts{
|
||||
VersionAndArgs: &protos.VersionAndArgs{
|
||||
Version: ver.Name(),
|
||||
Args: args,
|
||||
},
|
||||
modTime: fi.ModTime(),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
sort.Slice(rawvers, func(i, j int) bool {
|
||||
leftParsed := shared.ParseVersionString(rawvers[i].Version)
|
||||
rightParsed := shared.ParseVersionString(rawvers[j].Version)
|
||||
return shared.CompareVersionString(leftParsed, rightParsed) < 0
|
||||
return rawvers[i].modTime.After(rawvers[j].modTime)
|
||||
})
|
||||
return rawvers
|
||||
|
||||
for _, v := range rawvers {
|
||||
out = append(out, v.VersionAndArgs)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (hc *houstonClient) makeOperationQueryRequest() *protos.OperationQueryRequest {
|
||||
|
||||
@ -389,16 +389,6 @@ func (hc *houstonClient) launch(meta *procmeta) error {
|
||||
var errPrepareprocessLaunchFailed = errors.New("prepareProcessLaunch failed")
|
||||
|
||||
func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest, op protos.OperationClient) error {
|
||||
if req.Version == "latest" {
|
||||
// 최신 버전을 찾음
|
||||
latest, err := shared.FindLastestVersion(hc.config.StorageRoot, req.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
req.Version = latest
|
||||
}
|
||||
|
||||
meta := prepareProcessLaunch(hc.config.StorageRoot, req)
|
||||
if meta == nil {
|
||||
return errPrepareprocessLaunchFailed
|
||||
@ -433,16 +423,6 @@ func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest, op p
|
||||
}
|
||||
|
||||
func (hc *houstonClient) stopChildProcess(req *shared.StopProcessRequest, op protos.OperationClient) error {
|
||||
if req.Version == "latest" {
|
||||
// 최신 버전을 찾음
|
||||
latest, err := shared.FindLastestVersion(hc.config.StorageRoot, req.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
req.Version = latest
|
||||
}
|
||||
|
||||
killer := func(proc *procmeta) {
|
||||
proc.setState(protos.ProcessState_Stopping)
|
||||
if err := proc.cmd.Process.Signal(syscall.SIGTERM); err != nil {
|
||||
@ -509,16 +489,6 @@ func (hc *houstonClient) restartChildProcess(req *shared.RestartProcessRequest,
|
||||
}
|
||||
|
||||
func (hc *houstonClient) uploadFiles(req *shared.UploadRequest) error {
|
||||
if req.Version == "latest" {
|
||||
// 최신 버전을 찾음
|
||||
latest, err := shared.FindLastestVersion(hc.config.StorageRoot, req.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
req.Version = latest
|
||||
}
|
||||
|
||||
logger.Println("uploadFiles req :", *req)
|
||||
for _, child := range hc.childProcs {
|
||||
if child.version == req.Version && child.name == req.Name {
|
||||
|
||||
Reference in New Issue
Block a user