refactor: Use limit to prevent fetching all records

This commit is contained in:
Faruk AYDIN
2023-06-06 11:41:02 +02:00
committed by Ali BARIN
parent 75d5c0e356
commit 0784a2d4d0
3 changed files with 4 additions and 2 deletions

View File

@@ -91,6 +91,7 @@ class Flow extends Base {
async lastInternalId() {
const lastExecution = await this.$relatedQuery('executions')
.orderBy('created_at', 'desc')
.limit(1)
.first();
return lastExecution ? (lastExecution as Execution).internalId : null;