Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DawinYurtseven committed Dec 3, 2024
1 parent 01380c0 commit 5be048f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
13 changes: 11 additions & 2 deletions api/runner_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ func NotifyRunnerAssignments(dao dao.DaoWrapper) func() {
logger.Error("Can't get running actions", err)
}
for _, action := range activeAction {
if action.End.Before(time.Now().Add(5 * time.Minute)) {
if action.End.Before(time.Now().Add(-5 * time.Minute)) {
action.SetToIgnored()
err = dao.ActionDao.UpdateAction(ctx, &action)
log.Info("Action ignored, check for progress manually", "action", action.ID)
Expand Down Expand Up @@ -619,7 +619,13 @@ func AssignRunnerAction(dao dao.DaoWrapper, action *model.Action) error {
//TranscodingRequest(ctx, dao, runner)
break
}
action.SetToRunning()
//action.SetToRunning()
err = dao.ActionDao.UpdateAction(ctx, action)
if err != nil {
logger.Error("couldn't update action!", "error", err)
return err
}
logger.Info("runner counts", "count", len(action.AllRunners))
return nil
}

Expand All @@ -640,6 +646,7 @@ func CreateJob(dao dao.DaoWrapper, ctx context.Context, values map[string]interf
Status: 3,
Type: "stream",
Values: string(value),
End: values["end"].(time.Time),
})
job.Actions = append(job.Actions, actions...)
break
Expand All @@ -648,6 +655,7 @@ func CreateJob(dao dao.DaoWrapper, ctx context.Context, values map[string]interf
Status: 3,
Type: "transcode",
Values: string(value),
End: values["end"].(time.Time),
})
job.Actions = append(job.Actions, actions...)
break
Expand All @@ -656,6 +664,7 @@ func CreateJob(dao dao.DaoWrapper, ctx context.Context, values map[string]interf
Status: 3,
Type: "upload",
Values: string(value),
End: values["end"].(time.Time),
})
job.Actions = append(job.Actions, actions...)
break
Expand Down
2 changes: 2 additions & 0 deletions model/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (a *Action) IsCompleted() bool {
}

func (a *Action) GetCurrentRunner() (*Runner, error) {
logger.Info("runner count", "info", a)
if len(a.AllRunners) == 0 {
return nil, errors.New("no runner assigned")
}
Expand All @@ -72,6 +73,7 @@ func (a *Action) GetCurrentRunner() (*Runner, error) {

func (a *Action) AssignRunner(runner Runner) {
a.AllRunners = append(a.AllRunners, runner)
logger.Info("runner count", "count", len(a.AllRunners))
}

func (a *Action) GetValues() string {
Expand Down
4 changes: 3 additions & 1 deletion runner/ServerHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ func (r *Runner) ReadDiagnostics(retries int) {
return
}
actions := ""
for id, _ := range r.activeActions {
for id := range r.activeActions {
actions += fmt.Sprintln(id + ",")
}

r.log.Info("current actions of runner", "actions", actions)

_, err = con.Heartbeat(context.Background(), &protobuf.HeartbeatRequest{
Hostname: r.cfg.Hostname,
Port: int32(r.cfg.Port),
Expand Down
34 changes: 16 additions & 18 deletions web/ts/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,30 @@ export function getFailedAction(): void {
);
});
});
r
r;
}

export function listActions(actions: string): void {
window.dispatchEvent(new CustomEvent("load-actions"));
actions.split(",\n").forEach((id) => {
if (id === "") {
return;
}
fetch("/api/Actions/" + id).then((res) => {
res.text().then((text) => {
window.dispatchEvent(
new CustomEvent("ActionListing", {
detail: {
actions: JSON.parse(text),
},
}),
);
});
});
if (id === "") {
return;
}
);
var actionwindow = document.getElementById("actionList");
fetch("/api/Actions/" + id).then((res) => {
res.text().then((text) => {
window.dispatchEvent(
new CustomEvent("ActionListing", {
detail: {
actions: JSON.parse(text),
},
}),
);
});
});
});
const actionwindow = document.getElementById("actionList");
actionwindow.classList.toggle("show");

console.log(actionwindow.style.getPropertyValue("visibility"));
//actionwindow.classList.add

}

0 comments on commit 5be048f

Please sign in to comment.