[codeface] Re: [PATCH 2/2] Add warning statement when id service returns NA

  • From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • To: <codeface@xxxxxxxxxxxxx>, Mitchell Joblin <joblin.m@xxxxxxxxx>
  • Date: Tue, 15 Dec 2015 16:55:34 +0100



Am 11/12/2015 um 18:32 schrieb Mitchell Joblin:

- Returning NAs often occurs because of problematic characters
in the name string but we don't see the problem until we
try to insert that id into the database which manifests
as a foreign key constrait violation

Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx>
---
codeface/R/id_manager.r | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/codeface/R/id_manager.r b/codeface/R/id_manager.r
index fddbe44..7c82e91 100644
--- a/codeface/R/id_manager.r
+++ b/codeface/R/id_manager.r
@@ -76,7 +76,12 @@ query.decompose.user.id.cached <- function(host, port,
pid, name.str) {
}

query.decompose.user.id <- function(conf, name.str) {
- return(query.decompose.user.id.cached(conf$idServiceHostname,
- conf$idServicePort,
- conf$pid, name.str))
+ res <- query.decompose.user.id.cached(conf$idServiceHostname,
+ conf$idServicePort,
+ conf$pid, name.str)
+ if (is.na(res)) {
+ logwarn(sprintf("Id service returning NA for %s", name.str))
+ }

looks good to me, thanks. Side remark: We have 380 of str_c() and
paste(), but only 1 of sprintf() so far :)

Acked-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>

Thanks, Wolfgang
+
+ return(res)
}


Other related posts: