Skip to content

Commit

Permalink
2022.11.08:
Browse files Browse the repository at this point in the history
* changed: bash: board, inpage: responce file malform check and message
  • Loading branch information
andry81 committed Nov 8, 2022
1 parent 17a7bb5 commit 6416704
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
22 changes: 18 additions & 4 deletions bash/board/accum-stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,30 @@ views="$(sed -rn "$views_sed_regexp" "$TEMP_DIR/response.txt")"
stats_prev_exec_replies_inc=0
stats_prev_exec_views_inc=0

replies_malformed=1
views_malformed=1

# with check on malformed value
if [[ -n "$replies" ]]; then
if [[ -z "${replies//[0-9]/}" ]]; then
replies_malformed=0
fi
(( last_replies < replies )) && (( stats_prev_exec_replies_inc = replies - last_replies ))
fi
if [[ -n "$views" ]]; then
if [[ -z "${views//[0-9]/}" ]]; then
views_malformed=0
fi
(( last_views < views )) && (( stats_prev_exec_views_inc = views - last_views ))
fi

gh_print_notice_and_write_to_changelog_text_bullet_ln "query file size: $(stat -c%s "$TEMP_DIR/response.txt")"

gh_print_notice_and_write_to_changelog_text_bullet_ln "accum prev / next / diff: re vi: $last_replies $last_views / ${replies:-"-"} ${views:-"-"} / +$stats_prev_exec_replies_inc +$stats_prev_exec_views_inc"

# with check on integer value
[[ -z "$replies" || -n "${replies//[0-9]/}" ]] && replies=$last_replies
[[ -z "$views" || -n "${views//[0-9]/}" ]] && views=$last_views
# reset on malform
(( replies_malformed )) && replies=$last_replies
(( views_malformed )) && views=$last_views

# stats between last date and previous date (independent to the pipeline scheduler times)
replies_saved=0
Expand Down Expand Up @@ -171,7 +181,11 @@ fi
if (( last_replies >= replies && last_views >= views )); then
gh_enable_print_buffering
gh_print_warning_and_write_to_changelog_text_bullet_ln "$0: warning: nothing is changed, no new board replies/views." "nothing is changed, no new board replies/views"
if (( ! replies_malformed && ! views_malformed )); then
gh_print_warning_and_write_to_changelog_text_bullet_ln "$0: warning: nothing is changed, no new board replies/views." "nothing is changed, no new board replies/views"
else
gh_print_warning_and_write_to_changelog_text_bullet_ln "$0: warning: responce file is not valid, board replies/views value is malformed." "responce file is not valid, board replies/views value is malformed"
fi
(( ! CONTINUE_ON_EMPTY_CHANGES )) && exit 255
fi
Expand Down
16 changes: 13 additions & 3 deletions bash/inpage/accum-downloads.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,22 @@ downloads="$(sed -rn "$downloads_sed_regexp" "$TEMP_DIR/response.txt")"
# stats between previos/next script execution (dependent to the pipeline scheduler times)
stats_prev_exec_downloads_inc=0

downloads_malformed=1

# with check on malformed value
if [[ -n "$downloads" ]]; then
if [[ -z "${downloads//[0-9]/}" ]]; then
downloads_malformed=0
fi
(( last_downloads < downloads )) && (( stats_prev_exec_downloads_inc = downloads - last_downloads ))
fi

gh_print_notice_and_write_to_changelog_text_bullet_ln "query file size: $(stat -c%s "$TEMP_DIR/response.txt")"

gh_print_notice_and_write_to_changelog_text_bullet_ln "accum prev / next / diff: dl: $last_downloads / ${downloads:-"-"} / +$stats_prev_exec_downloads_inc"

# with check on integer value
[[ -z "$downloads" || -n "${downloads//[0-9]/}" ]] && downloads=0
# reset on malform
(( downloads_malformed )) && downloads=$last_downloads

# stats between last date and previous date (independent to the pipeline scheduler times)
stats_last_changed_date_downloads_inc=0
Expand Down Expand Up @@ -155,7 +161,11 @@ fi
if (( last_downloads >= downloads )); then
gh_enable_print_buffering
gh_print_warning_and_write_to_changelog_text_bullet_ln "$0: warning: nothing is changed, no new downloads." "nothing is changed, no new downloads"
if (( ! downloads_malformed )); then
gh_print_warning_and_write_to_changelog_text_bullet_ln "$0: warning: nothing is changed, no new downloads." "nothing is changed, no new downloads"
else
gh_print_warning_and_write_to_changelog_text_bullet_ln "$0: warning: responce file is not valid, downloads value is malformed." "responce file is not valid, downloads value is malformed"
fi
(( ! CONTINUE_ON_EMPTY_CHANGES )) && exit 255
fi
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2022.11.08:
* changed: bash: board, inpage: responce file malform check and message

2022.10.13:
* changed: _externals/tacklelib/bash/tacklelib: merge with the latest changes
* changed: bash: core refactor
Expand Down

0 comments on commit 6416704

Please sign in to comment.