Added QueueWData and QueueWDataWait to cli. Added Once prop to cron (these will be removed upon execution)

master
Paulo Simão 2022-03-01 08:05:11 -03:00
parent fa69db55c8
commit 98605a3f9b
2 changed files with 19 additions and 1 deletions

View File

@ -50,6 +50,11 @@ func (c *Cli) ReplayEnvAddr() string {
func (c *Cli) ReplayEnvHomeDir() string {
return os.Getenv("REPLAY_HOMEDIR")
}
func (c *Cli) ReplayPort() string {
return os.Getenv("REPLAY_PORT")
}
func (c *Cli) ReplayEnvRepo() string {
return os.Getenv("REPLAY_REPO")
}
@ -140,6 +145,14 @@ func (c *Cli) QueueEnqueue(id uint) error {
return c.HttpCli().JsonGet(fmt.Sprintf("/api/v1/robots/op/enqueue/%d", id), nil)
}
func (c *Cli) QueueEnqueueWData(id string, bs []byte) ([]byte, error) {
return c.HttpCli().RawPost(fmt.Sprintf("api/v1/queue/add/%s", id), bs)
}
func (c *Cli) QueueEnqueueWDataWait(id string, bs []byte) ([]byte, error) {
return c.HttpCli().RawPost(fmt.Sprintf("api/v1/queue/addwait?job=%s", id), bs)
}
func (c *Cli) ServiceStopAll() error {
return c.HttpCli().JsonGet("/api/v1/service/op/stopall", nil)
}

View File

@ -214,7 +214,11 @@ type Log struct {
}
func (l *Log) Write(p []byte) (n int, err error) {
os.Stdout.Write([]byte(fmt.Sprintf("- %s\n", string(p))))
_, err = os.Stdout.Write([]byte(fmt.Sprintf("- %s\n", string(p))))
if err != nil {
println(fmt.Sprintf("Log.Write:: Error writing log: %s", err.Error()))
return 0, err
}
l.AddHistory(string(p))
return len(p), nil
}
@ -311,6 +315,7 @@ type Cron struct {
Enabled *bool `json:"enabled"`
Data string `json:"data"`
Comments string `json:"comments"`
Once bool `json:"once"`
}
//type Resource struct {