From 73d4043b00609e912b2f8356dac3b594abe39d4c Mon Sep 17 00:00:00 2001 From: Sergei Date: Thu, 25 Apr 2019 16:20:12 +0300 Subject: [PATCH] HG-473: optimize memory consuption by dmt_client (#309) --- apps/hellgate/src/hg_domain.erl | 9 ++++----- rebar.lock | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/hellgate/src/hg_domain.erl b/apps/hellgate/src/hg_domain.erl index 90ecef3..3fd0ec4 100644 --- a/apps/hellgate/src/hg_domain.erl +++ b/apps/hellgate/src/hg_domain.erl @@ -39,8 +39,7 @@ -spec head() -> revision(). head() -> - #'Snapshot'{version = Version} = dmt_client:checkout({head, #'Head'{}}), - Version. + dmt_client:get_last_version(). -spec all(revision()) -> dmsl_domain_thrift:'Domain'(). @@ -54,7 +53,7 @@ get(Revision, Ref) -> try extract_data(dmt_client:checkout_object({version, Revision}, Ref)) catch - throw:object_not_found -> + throw:#'ObjectNotFound'{} -> error({object_not_found, {Revision, Ref}}) end. @@ -64,7 +63,7 @@ find(Revision, Ref) -> try extract_data(dmt_client:checkout_object({version, Revision}, Ref)) catch - throw:object_not_found -> + throw:#'ObjectNotFound'{} -> notfound end. @@ -75,7 +74,7 @@ exists(Revision, Ref) -> _ = dmt_client:checkout_object({version, Revision}, Ref), true catch - throw:object_not_found -> + throw:#'ObjectNotFound'{} -> false end. diff --git a/rebar.lock b/rebar.lock index 277b2f5..e11f325 100644 --- a/rebar.lock +++ b/rebar.lock @@ -14,11 +14,11 @@ 0}, {<<"dmt_client">>, {git,"git@github.com:rbkmoney/dmt_client.git", - {ref,"2d122747132c6c1d158ea0fb4c84068188541eff"}}, + {ref,"635dc0fb1928cfc8f81a17eddfffde0edfbf84a5"}}, 0}, {<<"dmt_core">>, {git,"git@github.com:rbkmoney/dmt_core.git", - {ref,"045c78132ecce5a8ec4a2e6ccd2c6b0b65bade1f"}}, + {ref,"357066d8be36ce1032d2d6c0d4cb31eb50730335"}}, 1}, {<<"erl_health">>, {git,"https://github.com/rbkmoney/erlang-health.git",