<commit_before>define(['backbone'], function(Backbone){
       
  /*
   DISTL Plot Data
   
   pass through 
        nimg: number of images, 
        timestamp: unixtime 
   to get autopolling
   
  */
    
  return Backbone.Model.extend({
    urlRoot: '/dc/imq',
                   
    initialize: function(options) {
      this.nimg = options.nimg
      this.pm = options.pm
      this.bind('sync', this.poll, this)
      this.refresh_thread = null
      this.running = true
    },
                                           
    parse: function(r, options) {
      return { data: r }
    },
      
    stop: function() {
      clearTimeout(this.refresh_thread)
      this.running = false
    },
                                           
    poll: function() {
      clearTimeout(this.refresh_thread)
      if (this.running) {
        var refresh = true
        var d = this.get('data')
        if (d && d[0].length > 0) {
          if (this.nimg == _.last(d[0])[0]) refresh = false
          if (this.pm.get('AGE') > 15) refresh = false
        }

        if (refresh) this.refresh_thread = setTimeout(this.fetch.bind(this), 10000)
      }
    },
  })
       
})<commit_msg>fix to stop polling distl model<commit_after>define(['backbone'], function(Backbone){
       
  /*
   DISTL Plot Data
   
   pass through 
        nimg: number of images, 
        timestamp: unixtime 
   to get autopolling
   
  */
    
  return Backbone.Model.extend({
    urlRoot: '/dc/imq',
                   
    initialize: function(options) {
      this.nimg = options.nimg
      this.pm = options.pm
      this.bind('sync', this.poll, this)
      this.refresh_thread = null
      this.running = true
    },
                                           
    parse: function(r, options) {
      return { data: r }
    },
      
    stop: function() {
      clearTimeout(this.refresh_thread)
      this.running = false
    },
                                           
    poll: function() {
      clearTimeout(this.refresh_thread)
      if (this.running) {
        var refresh = true
        var d = this.get('data')
        if (d && d[0].length > 0) {
          if (this.nimg == _.last(d[0])[0]) refresh = false
        }
        if (this.pm.get('AGE') > 15) refresh = false
        if (refresh) this.refresh_thread = setTimeout(this.fetch.bind(this), 10000)
      }
    },
  })
       
})
{'fraction_non_alphanumeric': 0.12042105263157894, 'fraction_numerical': 0.009263157894736843, 'mean_word_length': 1.4931794333683106, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2259136', 'n_tokens_mistral': 729, 'n_tokens_neox': 690, 'n_words': 153}