From e8ba805afd78ed537affe82c325d98cfcf9711bb Mon Sep 17 00:00:00 2001 From: Tobias Oetiker Date: Mon, 26 Jun 2023 14:20:05 +0200 Subject: [PATCH] release 0.46.4 propper logging for async getters --- CHANGES | 10 ++++++++++ lib/CallBackery.pm | 2 +- lib/CallBackery/GuiPlugin/AbstractForm.pm | 10 +++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index fbf654a..babd5cd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,13 @@ +0.46.4 2023-06-26 14:19:27 +0200 Tobias Oetiker + + - propper logging for async getters + +0.46.3 2023-06-14 18:30:45 +0200 Tobias Oetiker + + - fix base schema for yaml config files + - switch schema to draft2019 + - do not reconfigure automatically if the secret file is missing + 0.46.2 2023-06-12 15:00:43 +0200 Tobias Oetiker - fix restore process to properly reconnect to database diff --git a/lib/CallBackery.pm b/lib/CallBackery.pm index 9b6341d..69ff5f1 100644 --- a/lib/CallBackery.pm +++ b/lib/CallBackery.pm @@ -37,7 +37,7 @@ use CallBackery::Plugin::Doc; use CallBackery::Database; use CallBackery::User; -our $VERSION = '0.46.3'; +our $VERSION = '0.46.4'; =head2 config diff --git a/lib/CallBackery/GuiPlugin/AbstractForm.pm b/lib/CallBackery/GuiPlugin/AbstractForm.pm index 4977d56..d81fcac 100644 --- a/lib/CallBackery/GuiPlugin/AbstractForm.pm +++ b/lib/CallBackery/GuiPlugin/AbstractForm.pm @@ -171,7 +171,15 @@ sub getFieldValue { if (ref $entry->{getter} eq 'CODE'){ my $start = time; my $data = $entry->{getter}->($self); - $self->log->debug(sprintf("getter %s: %0.2fs",$field,time-$start)); + if (eval { blessed $data && $data->isa('Mojo::Promise')}){ + $data = $data->then(sub ($value) { + $self->log->debug(sprintf("async getter %s: %0.2fs",$field,time-$start)); + return $value; + }); + } + else { + $self->log->debug(sprintf("getter %s: %0.2fs",$field,time-$start)); + } return $data; } else {