-
Notifications
You must be signed in to change notification settings - Fork 24
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
base: master
Are you sure you want to change the base?
Conversation
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'); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) {
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