mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-20 03:51:00 +00:00
add delay to in memory service and update check interval
This commit is contained in:
parent
82f5706350
commit
37f2f2cdf6
@ -47,7 +47,7 @@ import { DonutChartComponent } from './donut-chart/donut-chart.component';
|
||||
cookieName: 'CSRF-Token-' + deviceID(),
|
||||
}),
|
||||
environment.production ?
|
||||
[] : HttpClientInMemoryWebApiModule.forRoot(InMemoryConfigDataService),
|
||||
[] : HttpClientInMemoryWebApiModule.forRoot(InMemoryConfigDataService, { delay: 200 }),
|
||||
MatCardModule,
|
||||
FlexLayoutModule
|
||||
],
|
||||
|
@ -19,7 +19,6 @@ export class DonutChartComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
console.log("elementID?", this.elementID)
|
||||
this.canvas = document.getElementById(this.elementID);
|
||||
this.ctx = this.canvas.getContext('2d');
|
||||
const myChart = new Chart(this.ctx, {
|
||||
|
@ -109,7 +109,6 @@ export class InMemoryConfigDataService {
|
||||
"ignoredDevices": [],
|
||||
"ignoredFolders": []
|
||||
}
|
||||
console.log("in mem?!?!?", config)
|
||||
return { config };
|
||||
}
|
||||
constructor() { }
|
||||
|
@ -17,7 +17,6 @@ export class StatusListComponent implements OnInit {
|
||||
}
|
||||
|
||||
onToggle(s: Status) {
|
||||
console.log("holy moly", s);
|
||||
this.currentStatus = s;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ export class SystemConfigService {
|
||||
private systemConfigUrl = environment.production ? apiURL + 'rest/system/config' : 'api/config';
|
||||
private httpOptions;
|
||||
|
||||
private checkInterval: number = 500;
|
||||
private checkInterval: number = 100;
|
||||
|
||||
constructor(private http: HttpClient, private cookieService: CookieService) {
|
||||
this.httpOptions = { headers: new HttpHeaders(this.cookieService.getCSRFHeader()) };
|
||||
@ -53,9 +53,10 @@ export class SystemConfigService {
|
||||
} else {
|
||||
// create timer to keep checking for folders
|
||||
let t = setInterval(() => {
|
||||
if (check(this.folders))
|
||||
if (this.folders) {
|
||||
clearInterval(t);
|
||||
observer.next(this.folders);
|
||||
observer.next(this.folders);
|
||||
}
|
||||
}, this.checkInterval);
|
||||
}
|
||||
});
|
||||
@ -68,7 +69,7 @@ export class SystemConfigService {
|
||||
observer.next(this.devices);
|
||||
} else {
|
||||
let t = setInterval(() => {
|
||||
if (check(this.devices)) {
|
||||
if (this.devices) {
|
||||
clearInterval(t);
|
||||
observer.next(this.devices);
|
||||
}
|
||||
@ -77,11 +78,4 @@ export class SystemConfigService {
|
||||
});
|
||||
return deviceObserverable;
|
||||
}
|
||||
}
|
||||
|
||||
const check = (target: any): Boolean => {
|
||||
if (target) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
Loading…
Reference in New Issue
Block a user