<commit_before>/* eslint-disable no-console, camelcase */
import raven from 'raven'
import config from 'src/config'
import {connect} from 'src/db'

const r = connect()
const sentry = new raven.Client(config.server.sentryDSN)

export default function projectArtifactChanged(projectArtifactChangedQueue) {
  r.table('projects').changes()
    .filter(r.row('new_val')('artifactURL').ne(r.row('old_val')('artifactURL')))
    .then(cursor => {
      cursor.each((err, {new_val: project}) => {
        if (err) {
          console.error(err)
          sentry.captureException(err)
          return
        }

        projectArtifactChangedQueue.add(project)
      })
    })
}<commit_msg>attempt `projectArtifactChanged` jobs 3x w/ 10s b/t each attempt<commit_after>/* eslint-disable no-console, camelcase */
import raven from 'raven'
import config from 'src/config'
import {connect} from 'src/db'

const r = connect()
const sentry = new raven.Client(config.server.sentryDSN)

export default function projectArtifactChanged(projectArtifactChangedQueue) {
  r.table('projects').changes()
    .filter(r.row('new_val')('artifactURL').ne(r.row('old_val')('artifactURL')))
    .then(cursor => {
      cursor.each((err, {new_val: project}) => {
        if (err) {
          console.error(err)
          sentry.captureException(err)
          return
        }

        const jobOpts = {
          attempts: 3,
          backoff: {type: 'fixed', delay: 10000},
        }
        projectArtifactChangedQueue.add(project, jobOpts)
      })
    })
}
{'fraction_non_alphanumeric': 0.1404310907903331, 'fraction_numerical': 0.005878510777269758, 'mean_word_length': 3.1630434782608696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4436694', 'n_tokens_mistral': 493, 'n_tokens_neox': 476, 'n_words': 96}