Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updatePlanTags In Crawler Can Be Called From A Cron Job #500

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TomerMe2
Copy link
Collaborator

I made the adjustments for updatePlanTags in order for us to call it from a cron job.
It updates the tags of the necessary plans only.

Closes #393

exports.up = function(knex) {
return knex.schema.table('plan', table => {
// some default time
table.dateTime('last_tags_update').notNullable().defaultTo('2000-01-01 00:00:01');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not null?

@@ -307,7 +307,6 @@ const updatePlanTags = async () => {
// Re-compute the tags of a plan if the last update time of the plan is after the last update time of the tags of this plan.
// Before re-computing the tags of a plan, remove all previous tags for this plan.

// TODO: Loop on the plans that need to be updated
const plans = await Plan.getPlansToTag();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please limit to 5 plans

} catch (err) {
Log.error(err);
Log.error('had a problem saving tags for plan ' + plan_id + '\n' + err);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log.error(problem saving tags for plan ${plan_id} , err);

@@ -307,7 +307,6 @@ const updatePlanTags = async () => {
// Re-compute the tags of a plan if the last update time of the plan is after the last update time of the tags of this plan.
// Before re-computing the tags of a plan, remove all previous tags for this plan.

// TODO: Loop on the plans that need to be updated
const plans = await Plan.getPlansToTag();
Log.info(`Processing ${plans.models.length} plans`);
for (const planOrder in plans.models) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for await (const planOrder of plans.models) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tag Maker Job
3 participants