Skip to content

Commit

Permalink
change limitDailyRelancesByRequest #2181
Browse files Browse the repository at this point in the history
  • Loading branch information
numew committed Feb 14, 2024
1 parent 63abd7a commit 78c8290
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ MAINTENANCE_ENABLE=0
MAINTENANCE_BANNER_ENABLE=0
MAINTENANCE_BANNER_MESSAGE="Une opération de maintenance est prévu le XX/XX/XXXX à XX:XX. Le site sera indisponible pendant la durée de l'opération."
AXIOS_TIMEOUT=30000
LIMIT_DAILY_RELANCES_BY_REQUEST=275
### histologe ###

### object storage S3 ###
Expand Down
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ MAINTENANCE_ENABLE=0
MAINTENANCE_BANNER_ENABLE=0
MAINTENANCE_BANNER_MESSAGE="Une opération de maintenance est prévu le XX/XX/XXXX à XX:XX. Le site sera indisponible pendant la durée de l'opération."
AXIOS_TIMEOUT=30000
LIMIT_DAILY_RELANCES_BY_REQUEST=275

###> knplabs/knp-snappy-bundle ###
WKHTMLTOPDF_PATH=wkhtmltopdf
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ clear-pool: ## Clear cache pool: make clear-pool pool=[pool_name]
console: ## Execute application command
@echo $(SYMFONY) app:$(app)
@$(DOCKER_COMP) exec -it histologe_phpfpm $(SYMFONY) app:$(app)

console-profile: ## Execute application command
@echo $(SYMFONY) app:$(app)
@$(DOCKER_COMP) exec -it histologe_phpfpm $(SYMFONY) --profile app:$(app)

upload: ## Push objects to S3 Bucket
./scripts/upload-s3.sh $(action) $(zip) $(debug)
Expand Down
1 change: 0 additions & 1 deletion src/Entity/Suivi.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class Suivi

public const DEFAULT_PERIOD_INACTIVITY = 30;
public const DEFAULT_PERIOD_RELANCE = 45;
public const LIMIT_DAILY_RELANCES = 200;

public const DESCRIPTION_MOTIF_CLOTURE_ALL = 'Le signalement a été cloturé pour tous';
public const DESCRIPTION_MOTIF_CLOTURE_PARTNER = 'Le signalement a été cloturé pour';
Expand Down
17 changes: 9 additions & 8 deletions src/Repository/SuiviRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\NoResultException;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

/**
* @method Suivi|null find($id, $lockMode = null, $lockVersion = null)
Expand All @@ -21,8 +22,11 @@
*/
class SuiviRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
public function __construct(
ManagerRegistry $registry,
#[Autowire(env: 'LIMIT_DAILY_RELANCES_BY_REQUEST')]
private int $limitDailyRelancesByRequest
) {
parent::__construct($registry, Suivi::class);
}

Expand Down Expand Up @@ -199,7 +203,6 @@ private function getSignalementsQuery(

public function findSignalementsLastSuiviPublic(
int $period = Suivi::DEFAULT_PERIOD_RELANCE,
int $limit = Suivi::LIMIT_DAILY_RELANCES,
): array {
$connection = $this->getEntityManager()->getConnection();

Expand All @@ -226,7 +229,7 @@ public function findSignalementsLastSuiviPublic(
GROUP BY s.id
HAVING DATEDIFF(NOW(), IFNULL(last_posted_at, s.created_at)) > :day_period
ORDER BY last_posted_at
LIMIT '.$limit;
LIMIT '.$this->limitDailyRelancesByRequest;

$statement = $connection->prepare($sql);

Expand All @@ -235,7 +238,6 @@ public function findSignalementsLastSuiviPublic(

public function findSignalementsLastSuiviTechnical(
int $period = Suivi::DEFAULT_PERIOD_INACTIVITY,
int $limit = Suivi::LIMIT_DAILY_RELANCES,
): array {
$connection = $this->getEntityManager()->getConnection();

Expand All @@ -261,8 +263,7 @@ public function findSignalementsLastSuiviTechnical(
AND s.statut NOT IN (:status_need_validation, :status_closed, :status_archived, :status_refused)
AND s.is_imported != 1
AND (s.is_usager_abandon_procedure != 1 OR s.is_usager_abandon_procedure IS NULL)
LIMIT '.$limit;

LIMIT '.$this->limitDailyRelancesByRequest;
$statement = $connection->prepare($sql);

return $statement->executeQuery($parameters)->fetchFirstColumn();
Expand All @@ -283,7 +284,7 @@ public function findSignalementsForThirdRelance(
];

$sql = $this->getSignalementsLastSuivisTechnicalsQuery(excludeUsagerAbandonProcedure: true, dayPeriod: $period);

$sql .= ' LIMIT '.$this->limitDailyRelancesByRequest;
$statement = $connection->prepare($sql);

return $statement->executeQuery($parameters)->fetchFirstColumn();
Expand Down

0 comments on commit 78c8290

Please sign in to comment.