summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2020-08-28 04:30:39 -0400
committerNick Vatamaniuc <nickva@users.noreply.github.com>2020-09-15 16:13:46 -0400
commit9897cd84a37fa0062dfba15f2e0eb6cc611be74a (patch)
tree520a75840c4cc093e3590da64adbb46140c70169
parente3b1c418ebc9735a46ef8e1f36d09d7023939372 (diff)
downloadcouchdb-9897cd84a37fa0062dfba15f2e0eb6cc611be74a.tar.gz
Handle possible iodata from jiffy:encode in couch_jobs
Also, ensure to use the same options as other couch apps: force_utf8 and dedupe_keys.
-rw-r--r--src/couch_jobs/src/couch_jobs_fdb.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/couch_jobs/src/couch_jobs_fdb.erl b/src/couch_jobs/src/couch_jobs_fdb.erl
index 3fcad554a..27131ec86 100644
--- a/src/couch_jobs/src/couch_jobs_fdb.erl
+++ b/src/couch_jobs/src/couch_jobs_fdb.erl
@@ -414,7 +414,7 @@ init_cache() ->
%
encode_data(#{} = JobData) ->
try
- jiffy:encode(JobData)
+ iolist_to_binary(jiffy:encode(JobData, [force_utf8]))
catch
throw:{error, Error} ->
% legacy clause since new versions of jiffy raise error instead
@@ -431,7 +431,7 @@ decode_data(#{} = JobData) ->
JobData;
decode_data(<<_/binary>> = JobData) ->
- jiffy:decode(JobData, [return_maps]).
+ jiffy:decode(JobData, [dedupe_keys, return_maps]).
% Cached job transaction object. This object wraps a transaction, caches the