This commit is contained in:
Kherel 2021-04-10 11:51:36 +02:00
parent cd49f9fb45
commit 6726c87de7
2 changed files with 3 additions and 2 deletions

View file

@ -38,7 +38,7 @@ class HetznerMetricsCubit extends Cubit<HetznerMetricsState> {
} }
void load(Period period) async { void load(Period period) async {
var newState = await repository.getMetrics(state.period); var newState = await repository.getMetrics(period);
timer = Timer( timer = Timer(
Duration(seconds: newState.stepInSeconds.toInt()), Duration(seconds: newState.stepInSeconds.toInt()),
() => load(newState.period), () => load(newState.period),

View file

@ -6,6 +6,7 @@ import 'hetzner_metrics_cubit.dart';
class HetznerMetricsRepository { class HetznerMetricsRepository {
Future<HetznerMetricsLoaded> getMetrics(Period period) async { Future<HetznerMetricsLoaded> getMetrics(Period period) async {
print(period);
var end = DateTime.now(); var end = DateTime.now();
DateTime start; DateTime start;
@ -21,7 +22,7 @@ class HetznerMetricsRepository {
break; break;
} }
var api = HetznerApi(); var api = HetznerApi(hasLoger: true);
var results = await Future.wait([ var results = await Future.wait([
api.getMetrics(start, end, 'cpu'), api.getMetrics(start, end, 'cpu'),