sr-npm 1.7.1317 → 1.7.1318
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/data.js +53 -40
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -250,18 +250,18 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
|
|
|
250
250
|
try {
|
|
251
251
|
// let jobsWithNoDescriptions = await getJobsWithNoDescriptions();
|
|
252
252
|
|
|
253
|
-
if (siteconfig.customFields==="true") {
|
|
254
|
-
|
|
253
|
+
// if (siteconfig.customFields==="true") {
|
|
254
|
+
// let customValues = await getAllCustomValues();
|
|
255
255
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
// console.log("inserting jobs references to custom values collection");
|
|
257
|
+
// console.log("customValues: ",customValues)
|
|
258
|
+
// console.log("customValues.items: ",customValues.items)
|
|
259
259
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
260
|
+
// for (const value of customValues.items) {
|
|
261
|
+
// await insertJobsReference(value._id, value.valueId);
|
|
262
|
+
// }
|
|
263
|
+
// console.log("inserted jobs references to custom values collection successfully");
|
|
264
|
+
// }
|
|
265
265
|
|
|
266
266
|
// let totalUpdated = 0;
|
|
267
267
|
// let totalFailed = 0;
|
|
@@ -281,6 +281,7 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsWithNo
|
|
|
281
281
|
//const pageChunks = Math.ceil(jobsWithNoDescriptions.items.length / API_CHUNK_SIZE);
|
|
282
282
|
const richContentConverterToken = await getTokenFromCMS(TOKEN_NAME.RICH_CONTENT_CONVERTER_TOKEN);
|
|
283
283
|
|
|
284
|
+
console.log("before promise all")
|
|
284
285
|
jobsWithNoDescriptions=await Promise.all(jobsWithNoDescriptions.map( async job => {
|
|
285
286
|
const jobDetails = await fetchJobDescription(job._id);
|
|
286
287
|
const richContentDescription= await htmlRichContentConverter(jobDetails.jobAd.sections,richContentConverterToken);
|
|
@@ -538,37 +539,49 @@ async function syncJobsFast() {
|
|
|
538
539
|
const status=await saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS(jobsData);
|
|
539
540
|
|
|
540
541
|
console.log("status inside syncJobsFast: ",status);
|
|
541
|
-
if(status.success){
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
let totalSaved = 0;
|
|
546
|
-
const totalChunks = Math.ceil(updatedJobs.length / chunkSize);
|
|
547
|
-
|
|
548
|
-
console.log(
|
|
549
|
-
|
|
550
|
-
);
|
|
542
|
+
// if(status.success){
|
|
543
|
+
// await clearCollections();
|
|
544
|
+
// const updatedJobs=status.updatedJobs;
|
|
545
|
+
// const chunkSize = 1000;
|
|
546
|
+
// let totalSaved = 0;
|
|
547
|
+
// const totalChunks = Math.ceil(updatedJobs.length / chunkSize);
|
|
548
|
+
|
|
549
|
+
// console.log(
|
|
550
|
+
// `Processing ${updatedJobs.length} jobs in ${totalChunks} chunks of max ${chunkSize} items each`
|
|
551
|
+
// );
|
|
551
552
|
|
|
552
|
-
await chunkedBulkOperation({
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
});
|
|
570
|
-
console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${updatedJobs.length}`);
|
|
571
|
-
|
|
553
|
+
// await chunkedBulkOperation({
|
|
554
|
+
// items: updatedJobs,
|
|
555
|
+
// chunkSize,
|
|
556
|
+
// processChunk: async (chunk, chunkNumber) => {
|
|
557
|
+
// console.log(`Saving chunk ${chunkNumber}/${totalChunks}: ${chunk.length} jobs`);
|
|
558
|
+
// try {
|
|
559
|
+
// const result = await wixData.bulkSave(COLLECTIONS.JOBS, chunk);
|
|
560
|
+
// const saved = result.inserted + result.updated || chunk.length;
|
|
561
|
+
// totalSaved += saved;
|
|
562
|
+
// console.log(
|
|
563
|
+
// `✓ Chunk ${chunkNumber} saved successfully. Inserted: ${result.inserted}, Updated: ${result.updated}`
|
|
564
|
+
// );
|
|
565
|
+
// } catch (error) {
|
|
566
|
+
// console.error(`✗ Error saving chunk ${chunkNumber}:`, error);
|
|
567
|
+
// throw error;
|
|
568
|
+
// }
|
|
569
|
+
// },
|
|
570
|
+
// });
|
|
571
|
+
// console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${updatedJobs.length}`);
|
|
572
|
+
// if (siteconfig.customFields==="true") {
|
|
573
|
+
// let customValues = await getAllCustomValues();
|
|
574
|
+
|
|
575
|
+
// console.log("inserting jobs references to custom values collection");
|
|
576
|
+
// console.log("customValues: ",customValues)
|
|
577
|
+
// console.log("customValues.items: ",customValues.items)
|
|
578
|
+
|
|
579
|
+
// for (const value of customValues.items) {
|
|
580
|
+
// await insertJobsReference(value._id, value.valueId);
|
|
581
|
+
// }
|
|
582
|
+
// console.log("inserted jobs references to custom values collection successfully");
|
|
583
|
+
// }
|
|
584
|
+
// }
|
|
572
585
|
console.log("saved jobs descriptions and location apply url to CMS successfully");//change comment
|
|
573
586
|
|
|
574
587
|
await aggregateJobs();
|