1
0
mirror of https://github.com/beestat/app.git synced 2026-05-13 02:48:33 -04:00

Optimized away a slow query into a transaction.

This commit is contained in:
Jon Ziebell
2021-02-26 14:51:59 -05:00
parent 1c65cd6fcf
commit 089cbb69e3
4 changed files with 35 additions and 13 deletions
+2 -6
View File
@@ -8,8 +8,7 @@
class external_api_log extends cora\crud {
/**
* Insert an item into the log table using the transactionless database
* connection.
* Queue a create to happen at the end of the request.
*
* @param array $attributes The attributes to insert.
*
@@ -17,10 +16,7 @@ class external_api_log extends cora\crud {
*/
public function create($attributes) {
$attributes['user_id'] = $this->session->get_user_id();
// Insert using the transactionless connection.
$database = cora\database::get_transactionless_instance();
return $database->create($this->resource, $attributes, 'id');
$this->request->queue_create($this->resource, $attributes);
}
}