2.0.x-2.2.x/upload/catalog/controller/module/facebook_business.php [162:213]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                $json['success'] = true;
            }
        }

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }

    private function estimateFeedGenerationTime() {
        $product_total = $this->model_catalog_product->getTotalProducts();

        $num_of_samples = $product_total <= 500 ? $product_total : 500;

        if ($num_of_samples == 0) {
            return 30;
        }

        $feed_dryrun_filename = $this->getWritableProductFeedDir() . 'fbe_feed_dryrun.txt';
        $feed_dryrun_file = fopen($feed_dryrun_filename, 'ab');
        
        $start_time = time();
        $this->writeProductFeedFileInBatch($num_of_samples, $feed_dryrun_file);
        $end_time = time();

        $time_spent = $end_time - $start_time;

        $time_estimate = $time_spent * $product_total / $num_of_samples * 1.5 + 30;

        $time_previous_avg = $this->config->get('facebook_feed_runtime_avg');

        if (!$time_previous_avg) {
            $time_previous_avg = 0;
        }

        return max($time_estimate, $time_previous_avg);
    }
  
    private function estimateFeedGenerationTimeWithDecay($feed_gen_time) {
        // Update feed generation online time estimate w/ 25% decay.
        $old_feed_gen_time = $this->config->get('facebook_feed_runtime_avg');

        if (!$old_feed_gen_time) {
            $old_feed_gen_time = 0;
        }

        if ($feed_gen_time < $old_feed_gen_time) {
            $feed_gen_time = $feed_gen_time * 0.25 + $old_feed_gen_time * 0.75;
        }

        $data = array(
            'facebook_feed_runtime_avg' => $feed_gen_time
        );
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



3.0.x-and-above/upload/catalog/controller/extension/module/facebook_business.php [163:215]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                $json['success'] = true;
            }
        }

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }

    private function estimateFeedGenerationTime() {
        $product_total = $this->model_catalog_product->getTotalProducts();

        $num_of_samples = $product_total <= 500 ? $product_total : 500;

        if ($num_of_samples == 0) {
            return 30;
        }

        $feed_dryrun_filename = $this->getWritableProductFeedDir() . 'fbe_feed_dryrun.txt';
        $feed_dryrun_file = fopen($feed_dryrun_filename, 'ab');
        
        $start_time = time();
        $this->writeProductFeedFileInBatch($num_of_samples, $feed_dryrun_file);
        $end_time = time();

        $time_spent = $end_time - $start_time;

        $time_estimate = $time_spent * $product_total / $num_of_samples * 1.5 + 30;

        $time_previous_avg = $this->config->get('facebook_feed_runtime_avg');

        if (!$time_previous_avg) {
            $time_previous_avg = 0;
        }

        return max($time_estimate, $time_previous_avg);
    }
  

    private function estimateFeedGenerationTimeWithDecay($feed_gen_time) {
        // Update feed generation online time estimate w/ 25% decay.
        $old_feed_gen_time = $this->config->get('facebook_feed_runtime_avg');

        if (!$old_feed_gen_time) {
            $old_feed_gen_time = 0;
        }

        if ($feed_gen_time < $old_feed_gen_time) {
            $feed_gen_time = $feed_gen_time * 0.25 + $old_feed_gen_time * 0.75;
        }

        $data = array(
            'facebook_feed_runtime_avg' => $feed_gen_time
        );
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



