Skip to content

Commit

Permalink
Another attempt at fixing #47
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu committed May 1, 2023
1 parent 01daa88 commit 68a99a1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
httpx[http2]
appdirs
tabulate
msgpack
msgpack==1.0.5
orjson
semver==2.13.0
packageurl-python
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="appthreat-vulnerability-db",
version="5.1.2",
version="5.1.3",
author="Team AppThreat",
author_email="cloud@appthreat.com",
description="AppThreat's vulnerability database and package search library with a built-in file based storage. OSV, CVE, GitHub, npm are the primary sources of vulnerabilities.",
Expand All @@ -18,7 +18,7 @@
"httpx[http2]",
"appdirs",
"tabulate",
"msgpack",
"msgpack==1.0.5",
"orjson",
"semver==2.13.0",
"packageurl-python",
Expand Down
5 changes: 2 additions & 3 deletions vdb/lib/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def store(datas, db_file=config.vdb_bin_file, index_file=config.vdb_bin_index):
),
}
)
packed_obj = msgpack.packb(batch)
packed_obj = msgpack.packb(batch, use_bin_type=True)
with open(db_file, mode="ab") as fp:
store_pos = fp.tell()
fp.write(packed_obj)
Expand All @@ -55,6 +55,7 @@ def store(datas, db_file=config.vdb_bin_file, index_file=config.vdb_bin_index):
"index_list": index_list,
}
],
use_bin_type=True,
)
with open(index_file, mode="ab") as fp:
fp.write(index_obj)
Expand All @@ -69,7 +70,6 @@ def stream_read(db_file=config.vdb_bin_file):
with open(db_file, mode="rb") as fp:
unpacker = msgpack.Unpacker(
fp,
read_size=read_size,
use_list=1,
strict_map_key=False,
raw=False,
Expand Down Expand Up @@ -100,7 +100,6 @@ def stream_bulk_search(match_list, key_func, db_file=config.vdb_bin_file):
fp.seek(int(store_pos))
unpacker = msgpack.Unpacker(
fp,
read_size=read_size,
use_list=1,
strict_map_key=False,
raw=False,
Expand Down

0 comments on commit 68a99a1

Please sign in to comment.