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
No related branches found
No related tags found
No related merge requests found
...@@ -359,10 +359,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit { ...@@ -359,10 +359,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
} }
public graphmlLink() { 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 => { this.netex.graphmlLink(data).subscribe(response => {
return downLoadFile(response, "application/xml"); return downLoadFile(response, "application/xml");
}) });
} }
public async openSummary(item: Wrapper, zoom: boolean) { public async openSummary(item: Wrapper, zoom: boolean) {
......
...@@ -100,7 +100,7 @@ export class AnalysisService { ...@@ -100,7 +100,7 @@ export class AnalysisService {
} }
async getTasks() { 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); clearInterval(this.intervalId);
}); });
} }
...@@ -357,7 +357,11 @@ export class AnalysisService { ...@@ -357,7 +357,11 @@ export class AnalysisService {
startWatching() { startWatching() {
const watch = async () => { const watch = async () => {
if (this.tokens.length > 0) { 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) { if (!this.tasks) {
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment