{"record":{"id":"7d72912b68d7dc66","repo":"discourse/discourse","slug":"to-run-this-rake-task-in-a-production-site-set-th","errorCode":null,"errorMessage":"To run this rake task in a production site, set the value of `ALLOW_DEV_POPULATE` environment variable to \"1\"","messagePattern":"To run this rake task in a production site, set the value of `ALLOW_DEV_POPULATE` environment variable to \"1\"","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/discourse_dev/application_request.rb","lineNumber":27,"sourceCode":"    LEGACY_OVERHEAD = 3\n\n    WEEKEND_FACTOR = 0.7\n    JITTER_RANGE = 0.30\n    DRIFT_FLOOR = 0.5\n    SPIKE_MIN = 2.0\n    SPIKE_RANGE = 2.0\n\n    def initialize\n      settings = DiscourseDev.config.application_request\n      @baseline = settings[:logged_in_browser_pageviews_per_day]\n      @end_date = Date.yesterday\n      @start_date = 2.years.ago.to_date\n      @random = Random.new(DiscourseDev.config.seed || 1)\n    end\n\n    def populate!\n      unless Discourse.allow_dev_populate?\n        raise 'To run this rake task in a production site, set the value of `ALLOW_DEV_POPULATE` environment variable to \"1\"'\n      end\n\n      rows = build_rows\n      puts \"Seeding #{rows.size} application_requests rows from #{@start_date} to #{@end_date}\"\n      bulk_upsert(rows)\n      rows.size\n    end\n\n    def self.populate!\n      new.populate!\n    end\n\n    private\n\n    def build_rows\n      spike_dates = pick_spike_dates\n      total_days = [(@end_date - @start_date).to_i, 1].max\n      rows = []","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/discourse/discourse/blob/1b2d7253e854205d2c95c80b2c6a1cdd42e45059/lib/discourse_dev/application_request.rb#L9-L45","documentation":"Error \"To run this rake task in a production site, set the value of `ALLOW_DEV_POPULATE` environment variable to \"1\"\" thrown in discourse/discourse.","triggerScenarios":"Thrown at lib/discourse_dev/application_request.rb:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1b2d7253e854205d2c95c80b2c6a1cdd42e45059","analyzedAt":"2026-08-26T03:11:08.302Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}