Skip to content

Commit

Permalink
Merge pull request #1927 from laboro/ticket/OC-632_useless_flush_1_12
Browse files Browse the repository at this point in the history
OC-632: "Maximum function nesting level of '300' reached" running oro…
mkudelya authored Feb 17, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 62b7438 + ad8d7a6 commit c6b3598
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/Oro/Bundle/EmailBundle/Resources/config/process.yml
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@ definitions:
- '@create_entity':
class: JMS\JobQueueBundle\Entity\Job
attribute: $.syncJob
flush: true
arguments:
- 'oro:email:flag-sync'
- ['--seen=false', $.arguments]
@@ -43,7 +42,6 @@ definitions:
- '@create_entity':
class: JMS\JobQueueBundle\Entity\Job
attribute: $.syncJob
flush: true
arguments:
- 'oro:email:flag-sync'
- ['--seen=true', $.arguments]
9 changes: 3 additions & 6 deletions src/Oro/Bundle/ImapBundle/Resources/config/process.yml
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ definitions:
- '@create_entity':
class: JMS\JobQueueBundle\Entity\Job
attribute: $.syncJob
flush: true
flush: true # flush is used make sure that only one pending job will be created
arguments:
- $.command
clear_imap_email_folder_on_sync_enabled_change:
@@ -80,7 +80,7 @@ definitions:
- '@create_entity':
class: JMS\JobQueueBundle\Entity\Job
attribute: $.syncJob
flush: true
flush: true # flush is used make sure that only one pending job will be created
arguments:
- $.command
- '@tree':
@@ -92,12 +92,9 @@ definitions:
- '@create_entity':
class: JMS\JobQueueBundle\Entity\Job
attribute: $.syncJob
flush: true
arguments:
- $.command
- []
- false
- '@job_add_dependency':
- '@job_add_dependency': # called flush to make sure that only one pending job will be created
job: $.syncJob
dependency: $.runningJob

4 changes: 1 addition & 3 deletions src/Oro/Bundle/ImapBundle/Workflow/Action/DependencyJob.php
Original file line number Diff line number Diff line change
@@ -51,10 +51,8 @@ protected function executeAction($context)
$dependency = $this->contextAccessor->getValue($context, $this->dependency);

$job->addDependency($dependency);
$job->setState(Job::STATE_PENDING);

$this->doctrine->getManager()->persist($job);
$this->doctrine->getManager()->flush();
$this->doctrine->getManager()->flush(); // flush is required to allow following processes track this job
}

/**
2 changes: 2 additions & 0 deletions src/Oro/Component/Action/Resources/doc/actions.md
Original file line number Diff line number Diff line change
@@ -151,6 +151,8 @@ Create Entity
- attribute - attribute that will contain the created entity instance;
- flush - (optional) when flush in DB should be performed.
Immediately after entity creation if ``true`` or later if ``false`` (default value: false);
_Note: This option might significantly slow down an application,
so it should be set to "true" only if entity really must be flushed to DB during this action_;
- data - (optional) array of data that should be set to entity.

**Configuration Example**

0 comments on commit c6b3598

Please sign in to comment.