<commit_before>// Index selected topics and all posts inside those topics
//
'use strict';


const _        = require('lodash');
const Promise  = require('bluebird');
const Queue    = require('idoit');


const CHUNKS_TO_ADD    = 100;
const CHUNKS_MIN_COUNT = 1;
const POSTS_PER_CHUNK  = 100;


module.exports = function (N) {

  N.wire.on('init:jobs', function register_forum_topics_search_update_with_posts() {

    N.queue.registerTask({
      name: 'forum_topics_search_update_with_posts',
      pool: 'hard',
      baseClass: Queue.GroupTemplate,

      // 10 minute delay by default
      postponeDelay: 10 * 60 * 1000,

      init() {
        let [ ids ] = this.args;

        let tasks = ids.map(topic_id =>
          N.queue.forum_posts_search_update_by_topic(topic_id)
        );

        tasks.unshift(N.queue.forum_topics_search_update_by_ids(ids));

        this.__children_to_init__ = tasks;
      }
    });


    // Task to index forum posts from a selected topic (only used internally)
    //
    N.queue.registerTask({<commit_msg>Fix queue chain task init<commit_after>// Index selected topics and all posts inside those topics
//
'use strict';


const _        = require('lodash');
const Promise  = require('bluebird');
const Queue    = require('idoit');


const CHUNKS_TO_ADD    = 100;
const CHUNKS_MIN_COUNT = 1;
const POSTS_PER_CHUNK  = 100;


module.exports = function (N) {

  N.wire.on('init:jobs', function register_forum_topics_search_update_with_posts() {

    N.queue.registerTask({
      name: 'forum_topics_search_update_with_posts',
      pool: 'hard',
      baseClass: Queue.GroupTemplate,

      // 10 minute delay by default
      postponeDelay: 10 * 60 * 1000,

      init() {
        let [ ids ] = this.args;

        let tasks = ids.map(topic_id =>
          N.queue.forum_posts_search_update_by_topic(topic_id)
        );

        tasks.unshift(N.queue.forum_topics_search_update_by_ids(ids));

        return tasks;
      }
    });


    // Task to index forum posts from a selected topic (only used internally)
    //
    N.queue.registerTask({
{'fraction_non_alphanumeric': 0.1084973595775324, 'fraction_numerical': 0.01632261161785886, 'mean_word_length': 2.837937384898711, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '934371', 'n_tokens_mistral': 731, 'n_tokens_neox': 656, 'n_words': 153}