Skip to content
Snippets Groups Projects
Commit 36cf714a authored by AndiMajore's avatar AndiMajore
Browse files

reduced traffic and updates by only requesting unfinished tasks

parent 28f7373e
Branches
Tags v0.8.9-rc7
No related merge requests found
......@@ -359,10 +359,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
}
public graphmlLink() {
const data = {nodes: this.nodeData.nodes.get(), edges: this.nodeData.edges.get()}
const data = {nodes: this.nodeData.nodes.get(), edges: this.nodeData.edges.get()};
this.netex.graphmlLink(data).subscribe(response => {
return downLoadFile(response, "application/xml");
})
});
}
public async openSummary(item: Wrapper, zoom: boolean) {
......
......@@ -100,7 +100,7 @@ export class AnalysisService {
}
async getTasks() {
return await this.netex.getTasks(this.tokens).catch((e) => {
return await this.netex.getTasks(this.finishedTokens.length > 0 && this.tasks.length === 0 ? this.tokens : this.tokens.filter(t => this.finishedTokens.indexOf(t) === -1)).catch((e) => {
clearInterval(this.intervalId);
});
}
......@@ -357,7 +357,11 @@ export class AnalysisService {
startWatching() {
const watch = async () => {
if (this.tokens.length > 0) {
this.tasks = await this.getTasks();
const newtasks = await this.getTasks();
if (newtasks.length === 0)
return;
const newTaskIds = newtasks.map(t => t.token.toString());
this.tasks = newtasks.concat(this.tasks.filter(t => newTaskIds.indexOf(t.token) === -1));
if (!this.tasks) {
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment