Skip to content

Commit

Permalink
Add driverJobBatchSize config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Mar 20, 2024
1 parent 9ec2725 commit 03bd821
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- Added batchable generate cache jobs ([#537](https://github.com/putyourlightson/craft-blitz/issues/537)).
- Added a new `driverJobBatchSize` config setting that sets the batch size to use for driver jobs that support batching.
- Added a new `refreshCacheEnabled` config setting that determines whether cached pages are refreshed whenever content changes or an integration triggers it.
- Added a new `injectScriptPosition` config setting that determines the position in the HTML in which to output the injected script ([#636](https://github.com/putyourlightson/craft-blitz/issues/636)).
- Added a verbose output mode to `blitz/cache` console commands that can be activated by adding a `--verbose` flag ([#642](https://github.com/putyourlightson/craft-blitz/issues/642)).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Blitz provides intelligent static page caching for creating lightning-fast sites

## Documentation

Learn more and read the documentation at [putyourlightson.com/plugins/blitz ](https://putyourlightson.com/plugins/blitz)
Learn more and read the documentation at [putyourlightson.com/plugins/blitz »](https://putyourlightson.com/plugins/blitz)

## License

Expand Down
3 changes: 3 additions & 0 deletions src/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
// The priority to give the refresh cache job (the lower the number, the higher the priority). Set to `null` to inherit the default priority.
//'refreshCacheJobPriority' => 10,

//The batch size to use for driver jobs that support batching.
//'driverJobBatchSize' => 100,

// The priority to give driver jobs (the lower the number, the higher the priority). Set to `null` to inherit the default priority.
//'driverJobPriority' => 100,

Expand Down
10 changes: 10 additions & 0 deletions src/jobs/GenerateCacheJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ class GenerateCacheJob extends BaseBatchedJob implements RetryableJobInterface
*/
private Queue $queue;

/**
* @inheritdoc
*/
public function init(): void
{
parent::init();

$this->batchSize = Blitz::$plugin->settings->driverJobBatchSize;
}

/**
* @inheritdoc
*/
Expand Down
5 changes: 5 additions & 0 deletions src/models/SettingsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ class SettingsModel extends Model
*/
public int $refreshCacheJobPriority = 10;

/**
* The batch size to use for driver jobs that support batching.
*/
public int $driverJobBatchSize = 100;

/**
* The priority to give driver jobs (the lower the number, the higher the priority).
*/
Expand Down

0 comments on commit 03bd821

Please sign in to comment.