Skip to content

Commit

Permalink
move max memory to env
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanVukovic99 committed Jan 21, 2024
1 parent 783f451 commit b483ee0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
DEBUG_WORD=sehen
DICT_NAME=abc
DICT_NAME=abc
MAX_MEMORY_MB=8192
15 changes: 8 additions & 7 deletions auto.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

source .env

export DEBUG_WORD
export DICT_NAME
max_memory_mb=${MAX_MEMORY_MB:-8192}


# Check for the source_language and target_language arguments
if [ -z "$1" ] || [ -z "$2" ]; then
Expand Down Expand Up @@ -144,9 +145,8 @@ for entry in "${entries[@]}"; do
[ ! -f "data/tidy/$source_iso-$target_iso-forms.json" ] || \
[ ! -f "data/tidy/$source_iso-$target_iso-lemmas.json" ] || \
[ "$force_tidy" = true ]; then
echo "Tidying up $filename"
node --max-old-space-size=4096 3-tidy-up.js
else
node --max-old-space-size="$max_memory_mb" 3-tidy-up.js
else
echo "Tidy file already exists. Skipping tidying."
fi

Expand All @@ -159,9 +159,10 @@ for entry in "${entries[@]}"; do
[ ! -f "data/language/$source_iso/$target_iso/$ipa_file" ] || \
[ "$force_ymt" = true ]; then
echo "Creating Yomitan dict and IPA files"
if node --max-old-space-size=8192 4-make-yomitan.js; then
zip -j "$dict_file" data/temp/dict/index.json data/temp/dict/tag_bank_1.json data/temp/dict/term_bank_*.json
zip -j "$ipa_file" data/temp/ipa/index.json data/temp/ipa/tag_bank_1.json data/temp/ipa/term_meta_bank_*.json
if node --max-old-space-size="$max_memory_mb" 4-make-yomitan.js; then
echo "Zipping Yomitan files"
zip -qj "$dict_file" data/temp/dict/index.json data/temp/dict/tag_bank_1.json data/temp/dict/term_bank_*.json
zip -qj "$ipa_file" data/temp/ipa/index.json data/temp/ipa/tag_bank_1.json data/temp/ipa/term_meta_bank_*.json
else
echo "Error: Yomitan generation script failed."
fi
Expand Down

0 comments on commit b483ee0

Please sign in to comment.