Skip to content

Commit 65f60b8

Browse files
committed
Merge pull request #22 from daniel-rose/patch-1
Use the right config path
2 parents b89d868 + 88dcccb commit 65f60b8

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

app/code/community/Hackathon/AsyncIndex/Model/Manager.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public function executePartialIndex( Mage_Index_Model_Process $process )
1818
{
1919
/** @var $resourceModel Mage_Index_Model_Resource_Process */
2020
$resourceModel = Mage::getResourceSingleton('index/process');
21-
$resourceModel->beginTransaction();
21+
22+
if (Mage::getStoreConfigFlag('system/asyncindex/use_transactions')) {
23+
$resourceModel->beginTransaction();
24+
}
2225

2326
$indexMode = 'schedule';
2427
$pendingMode = 'pending';
@@ -36,11 +39,15 @@ public function executePartialIndex( Mage_Index_Model_Process $process )
3639
if ( count(Mage::getResourceSingleton('index/event')->getUnprocessedEvents($process)) === 0 ) {
3740
$process->changeStatus($pendingMode);
3841
}
39-
$resourceModel->commit();
42+
if (Mage::getStoreConfigFlag('system/asyncindex/use_transactions')) {
43+
$resourceModel->commit();
44+
}
4045
}
4146
catch (Exception $e)
4247
{
43-
$resourceModel->rollBack();
48+
if (Mage::getStoreConfigFlag('system/asyncindex/use_transactions')) {
49+
$resourceModel->rollBack();
50+
}
4451
throw $e;
4552
}
4653

app/code/community/Hackathon/AsyncIndex/etc/config.xml

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
<auto_index>1</auto_index>
9595
<scheduler_cron_expr>*/5 * * * *</scheduler_cron_expr>
9696
<event_limit>100</event_limit>
97+
<use_transactions>1</use_transactions>
9798
</asyncindex>
9899
</system>
99100
</default>

app/code/community/Hackathon/AsyncIndex/etc/system.xml

+9
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@
6060
<show_in_website>0</show_in_website>
6161
<show_in_store>0</show_in_store>
6262
</blacklist_indexes>
63+
<use_transactions>
64+
<label>Use Transactions for Partial Index</label>
65+
<frontend_type>select</frontend_type>
66+
<source_model>adminhtml/system_config_source_yesno</source_model>
67+
<sort_order>60</sort_order>
68+
<show_in_default>1</show_in_default>
69+
<show_in_website>0</show_in_website>
70+
<show_in_store>0</show_in_store>
71+
</use_transactions>
6372
</fields>
6473
</asyncindex>
6574
</groups>

0 commit comments

Comments
 (0)