Skip to content

Commit

Permalink
Storage - fixed handling of HTTP requests in SQL and Redis storage, t…
Browse files Browse the repository at this point in the history
…weaked handling of SQL schema updates.
  • Loading branch information
itsgoingd committed Nov 19, 2024
1 parent 11ac18b commit 847f813
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Clockwork/Storage/RedisStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class RedisStorage extends Storage
'headers', 'getData', 'postData', 'requestData', 'sessionData', 'authenticatedUser', 'cookies', 'middleware',
'databaseQueries', 'cacheQueries', 'modelsActions', 'modelsRetrieved', 'modelsCreated', 'modelsUpdated',
'modelsDeleted', 'redisCommands', 'queueJobs', 'timelineData', 'log', 'events', 'routes', 'notifications',
'emailsData', 'viewsData', 'userData', 'subrequests', 'xdebug', 'commandArguments', 'commandArgumentsDefaults',
'commandOptions', 'commandOptionsDefaults', 'jobPayload', 'jobOptions', 'testAsserts', 'parent',
'clientMetrics', 'webVitals'
'emailsData', 'viewsData', 'userData', 'httpRequests', 'subrequests', 'xdebug', 'commandArguments',
'commandArgumentsDefaults', 'commandOptions', 'commandOptionsDefaults', 'jobPayload', 'jobOptions', 'testAsserts',
'parent', 'clientMetrics', 'webVitals'
];

// Redis client instance
Expand Down
9 changes: 5 additions & 4 deletions Clockwork/Storage/SqlStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class SqlStorage extends Storage
'viewsData' => 'TEXT NULL',
'userData' => 'TEXT NULL',
'subrequests' => 'TEXT NULL',
'httpRequests' => 'TEXT NULL',
'xdebug' => 'TEXT NULL',
'commandName' => 'TEXT NULL',
'commandArguments' => 'TEXT NULL',
Expand Down Expand Up @@ -100,9 +101,9 @@ class SqlStorage extends Storage
'headers', 'getData', 'postData', 'requestData', 'sessionData', 'authenticatedUser', 'cookies', 'middleware',
'databaseQueries', 'cacheQueries', 'modelsActions', 'modelsRetrieved', 'modelsCreated', 'modelsUpdated',
'modelsDeleted', 'redisCommands', 'queueJobs', 'timelineData', 'log', 'events', 'routes', 'notifications',
'emailsData', 'viewsData', 'userData', 'subrequests', 'xdebug', 'commandArguments', 'commandArgumentsDefaults',
'commandOptions', 'commandOptionsDefaults', 'jobPayload', 'jobOptions', 'testAsserts', 'parent',
'clientMetrics', 'webVitals'
'emailsData', 'viewsData', 'userData', 'httpRequests', 'subrequests', 'xdebug', 'commandArguments',
'commandArgumentsDefaults', 'commandOptions', 'commandOptionsDefaults', 'jobPayload', 'jobOptions', 'testAsserts',
'parent', 'clientMetrics', 'webVitals'
];

// Return a new storage, takes PDO object or DSN and optionally a table name and database credentials as arguments
Expand Down Expand Up @@ -225,7 +226,7 @@ protected function initialize()
// first we get rid of existing table if it exists by renaming it so we won't lose any data
try {
$table = $this->quote($this->table);
$backupTableName = $this->quote("{$this->table}_backup_" . date('Ymd'));
$backupTableName = $this->quote("{$this->table}_backup_" . date('Ymd_His'));
$this->pdo->exec("ALTER TABLE {$table} RENAME TO {$backupTableName};");

$indexName = $this->quote("{$this->table}_time_index");
Expand Down

0 comments on commit 847f813

Please sign in to comment.