Skip to content

Commit

Permalink
Logs every Bible/book/chapter when processing user-generated change n…
Browse files Browse the repository at this point in the history
…otifications.

#962
  • Loading branch information
teusbenschop committed Sep 22, 2024
1 parent fa50bd6 commit 9637d0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions changes/modifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ void changes_modifications ()
// At the same time, produce change statistics per user.

std::vector <std::string> users = database::modifications::getUserUsernames ();
if (!users.empty ()) Database_Logs::log ("Change notifications: Per user", Filter_Roles::translator ());
for (const auto& user : users) {

// Total changes made by this user.
Expand All @@ -213,7 +212,9 @@ void changes_modifications ()
// Go through the chapters in that book.
const std::vector <int> chapters = database::modifications::getUserChapters (user, bible, book);
for (auto chapter : chapters) {


Database_Logs::log ("Change notifications: User " + user + " - Bible " + bible + " " + filter_passage_display (book, chapter, ""), Filter_Roles::translator ());

// Get the sets of identifiers for that chapter, and set some variables.
const std::vector <database::modifications::id_bundle> IdSets = database::modifications::getUserIdentifiers (user, bible, book, chapter);
int reference_new_id {0};
Expand Down
14 changes: 7 additions & 7 deletions database/modifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,13 @@ std::vector <int> getUserBooks (const std::string& username, const std::string&

std::vector <int> getUserChapters (const std::string& username, const std::string& bible, int book)
{
std::string folder = userBookFolder (username, bible, book);
std::vector <std::string> files = filter_url_scandir (folder);
const std::string folder = userBookFolder (username, bible, book);
const std::vector <std::string> files = filter_url_scandir (folder);
std::vector <int> chapters;
for (auto & file : files) {
std::string path = filter_url_create_path ({folder, file});
int time = filter_url_file_modification_time (path);
int days = (filter::date::seconds_since_epoch () - time) / 86400;
for (const auto& file : files) {
const std::string path = filter_url_create_path ({folder, file});
const int time = filter_url_file_modification_time (path);
const int days = (filter::date::seconds_since_epoch () - time) / 86400;
if (days > 5) {
// Unprocessed user changes older than so many days usually indicate a problem.
// Perhaps the server crashed so it never could process them.
Expand All @@ -447,7 +447,7 @@ std::vector <int> getUserChapters (const std::string& username, const std::strin
chapters.push_back (filter::strings::convert_to_int (file));
}
}
sort (chapters.begin(), chapters.end());
std::sort (chapters.begin(), chapters.end());
return chapters;
}

Expand Down
1 change: 1 addition & 0 deletions help/changelog.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<h1>ChangeLog</h1>

<p>5.1.019: Logs every Bible/book/chapter when processing user-generated change notifications.</p>
<p>5.1.019: No more send/receive lockups due to plenty of emails to be sent off.</p>
<p>5.1.019: Cloud logs and removes a consultation note without a passage.</p>
<p>5.1.019: Disable std::filesystem on Cloud and Linux because of erratic behaviour.</p>
Expand Down

0 comments on commit 9637d0e

Please sign in to comment.