开发者

What Code Runs After Executing a Dataflow Profile

开发者 https://www.devze.com 2023-04-13 01:25 出处:网络
Often, after executing a dataflow import profile (for products), the next request a user makes in the Admin Console will be significantly slower than normal requests.What\'s weird is, it seems tied to

Often, after executing a dataflow import profile (for products), the next request a user makes in the Admin Console will be significantly slower than normal requests. What's weird is, it seems tied to a particular browser session. i.e开发者_开发问答. If you're logged into the admin console in another browser, the system is responsive.

What code or processes are running that slow down subsequent Magento requests? I can think of a dozen things it could be (indexing, cron, etc.), I'm looking for the specific areas of code that tie this to the session, and what that code is doing.


My guess is in the Parser there is a for loop over the CSV file that constantly updates the session, on the bright side at least they realized to comment out initializing the models in the iteration loops and add them BEFORE:

class Mage_Dataflow_Model_Session_Parser_Csv extends Mage_Dataflow_Model_Convert_Parser_Abstract
{

    public function parse()
    {
        $fDel = $this->getVar('delimiter', ',');
        $fEnc = $this->getVar('enclose', '"');

        if ($fDel=='\\t') {
            $fDel = "\t";
        }

        // fixed for multibyte characters
        setlocale(LC_ALL, Mage::app()->getLocale()->getLocaleCode().'.UTF-8');

        $fp = tmpfile();
        fputs($fp, $this->getData());
        fseek($fp, 0);

        $data = array();
        $sessionId = Mage::registry('current_dataflow_session_id');
        $import = Mage::getModel('dataflow/import');
        $map = new Varien_Convert_Mapper_Column();
        for ($i=0; $line = fgetcsv($fp, 4096, $fDel, $fEnc); $i++) {
            if (0==$i) {
                if ($this->getVar('fieldnames')) {
                    $fields = $line;
                    continue;
                } else {
                    foreach ($line as $j=>$f) {
                        $fields[$j] = 'column'.($j+1);
                    }
                }
            }
            $row = array();
            foreach ($fields as $j=>$f) {
                $row[$f] = $line[$j];
            }
            /*
            if ($i <= 100)
            {
                $data[] = $row;
            }
            */
            //$map = new Varien_Convert_Mapper_Column();
            $map->setData(array($row));
            $map->map();
            $row = $map->getData();
            //$import = Mage::getModel('dataflow/import');
            $import->setImportId(0);
            $import->setSessionId($sessionId);
            $import->setSerialNumber($i);
            $import->setValue(serialize($row[0]));
            $import->save();
            //unset($import);
        }

...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号