Feat : Prio order for auto stream record
This commit is contained in:
@@ -122,17 +122,24 @@ class Hub {
|
||||
// Le profil n'est cherché que tant qu'il manque : une capture déjà
|
||||
// rattachée l'est pour de bon, inutile de reposer la question toutes les
|
||||
// deux secondes.
|
||||
spansRepo.touch(open.id, now, open.targetId ? null : this.recordedTargetId(agentId));
|
||||
spansRepo.touch(open.id, now, open.targetId ? null : this.recordingTarget(agentId)?.id ?? null);
|
||||
} else {
|
||||
spansRepo.open(agentId, this.recordedTargetId(agentId), now);
|
||||
spansRepo.open(agentId, this.recordingTarget(agentId)?.id ?? null, now);
|
||||
}
|
||||
}
|
||||
|
||||
/** Le profil que cette VM capture, d'après le pseudo sur lequel sa veille est calée. */
|
||||
private recordedTargetId(agentId: string): string | null {
|
||||
/**
|
||||
* Le profil que cette VM capture, d'après le pseudo sur lequel sa veille est
|
||||
* calée — `startTargetRecording()` l'y pose, c'est le seul lien fiable.
|
||||
*
|
||||
* Nul si la VM n'enregistre pas, ou si sa veille ne désigne aucun profil
|
||||
* suivi : une capture lancée à la main depuis l'onglet Agents, par exemple.
|
||||
*/
|
||||
recordingTarget(agentId: string): WatchTarget | null {
|
||||
if (!this.statusOf(agentId).recording) return null;
|
||||
const record = agentsRepo.get(agentId);
|
||||
if (!record?.watch.username) return null;
|
||||
return targetsRepo.findByUsername(record.watch.provider, record.watch.username)?.id ?? null;
|
||||
return targetsRepo.findByUsername(record.watch.provider, record.watch.username);
|
||||
}
|
||||
|
||||
resolveCommand(agentId: string, requestId: string, ok: boolean, data: unknown, error?: string): void {
|
||||
|
||||
Reference in New Issue
Block a user