tweak insert/update
This commit is contained in:
Родитель
21e7280a11
Коммит
f8b6a82dd3
|
@ -88,11 +88,11 @@ call_table_endpoint <- function(endpoint, path, options=list(), headers=list(),
|
|||
for(i in seq_len(num_retries))
|
||||
{
|
||||
res <- call_storage_endpoint(endpoint, path=path, options=options, body=body, headers=headers,
|
||||
http_verb=http_verb, http_status_handler="pass", return_headers=return_headers, ...)
|
||||
http_verb=http_verb, http_status_handler="pass", ...)
|
||||
if(httr::status_code(res) != 429)
|
||||
break
|
||||
Sys.sleep(1.5^i)
|
||||
}
|
||||
process_storage_response(res, match.arg(http_status_handler), FALSE)
|
||||
process_storage_response(res, match.arg(http_status_handler), return_headers)
|
||||
}
|
||||
|
||||
|
|
|
@ -91,9 +91,8 @@ insert_table_entity <- function(table, entity)
|
|||
check_column_names(entity)
|
||||
headers <- list(Prefer="return-no-content")
|
||||
res <- call_table_endpoint(table$endpoint, table$name, body=entity, headers=headers, http_verb="POST",
|
||||
http_status_handler="pass")
|
||||
httr::stop_for_status(res, storage_error_message(res))
|
||||
invisible(httr::headers(res)$ETag)
|
||||
return_headers=TRUE)
|
||||
res$etag
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,9 +119,8 @@ update_table_entity <- function(table, entity, row_key=NULL, partition_key=NULL,
|
|||
else list()
|
||||
path <- sprintf("%s(PartitionKey='%s',RowKey='%s')", table$name, entity$PartitionKey, entity$RowKey)
|
||||
res <- call_table_endpoint(table$endpoint, path, body=entity, headers=headers, http_verb="PUT",
|
||||
http_status_handler="pass")
|
||||
httr::stop_for_status(res, storage_error_message(res))
|
||||
invisible(httr::headers(res)$ETag)
|
||||
return_headers=TRUE)
|
||||
res$etag
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче