I log some of the api requests. It is currently done sync and I would like to process this DB call async to allow faster response times for the actual api call. The way to do this in Laravel seems to be the queue/job system. However I am not sure if this is also the case for a simple log entry added to the DB:
$log = new Log();
$log->request = $request->all();
$log->response = $response;
$log->save();
So, should I create a job and dispatch it for this? Seems like overkill to have a queue worker and all the boilerplate just for this.
EDIT: I just realized that this might be stupid anyways, since the queue also needs to write to the jobs table. So queuing something requires 1 DB query, right? So there is probably no point to use a job for a single query action.
Is there some other way to defer the execution of the logging until after the response?