Skip to content

Commit

Permalink
Fixed a bug in the prebuid script
Browse files Browse the repository at this point in the history
changed the tracking site
added catch handlers to getSavedFileInfo and getDuration
  • Loading branch information
Mattk70 committed May 24, 2024
1 parent a9abf75 commit 14acea6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion js/tracking.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const DEBUG = false;
const ID_SITE = 3;
const ID_SITE = 2;


function trackEvent(uuid, event, action, name, value){
Expand Down
4 changes: 2 additions & 2 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ const setMetadata = async ({ file, proxy = file, source_file = file }) => {
metadata[file] ??= { proxy: proxy };
metadata[file].proxy ??= proxy;
// CHeck the database first, so we honour any manual updates.
const savedMeta = await getSavedFileInfo(file);
const savedMeta = await getSavedFileInfo(file).catch(error => console.warn('getSavedFileInfo error', error));
// If we have stored imfo about the file, set the saved flag;
metadata[file].isSaved = !!savedMeta;
// Latitude only provided when updating location
Expand All @@ -1089,7 +1089,7 @@ const setMetadata = async ({ file, proxy = file, source_file = file }) => {
// using the nullish coalescing operator
metadata[file].locationID ??= savedMeta?.locationID;

metadata[file].duration ??= savedMeta?.duration || await getDuration(file);
metadata[file].duration ??= savedMeta?.duration || await getDuration(file).catch(error => console.warn('getDuration error', error));

return new Promise((resolve, reject) => {
if (metadata[file].isComplete) {
Expand Down
2 changes: 1 addition & 1 deletion prebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function searchPatterns(directory, patterns) {
const stats = fs.statSync(filePath);
if (stats.isDirectory() || file.endsWith('.js')){
if (stats.isDirectory()) {
if (filePath.includes('node_modules')) {
if (! filePath.includes('node_modules')) {
searchPatterns(filePath, patterns);
}
} else if (stats.isFile()) {
Expand Down

0 comments on commit 14acea6

Please sign in to comment.