Closed severin closed 4 months ago
@albus522 pinging you since I see that you are the most active committer in this repo 😉 Any interest in merging this? Feel free to close the PR as irrelevant if you don't think it makes sense.
Different database instances have different limits and I don't know that a general truncation is the correct approach here.
The actual database limit can be retrieved using Delayed::Job.type_for_attribute(:last_error).limit
. The limit is in bytes, not characters, so truncating should use e.g. truncate_bytes
.
Attempting to write unchecked error messages leads to exceptions with the mysql2 adapter (something like
ActiveRecord::ValueTooLong: Mysql2::Error: Data too long for column 'last_error'
).Assigning the error message and persisting the job (when rescheduling it) happens in the exception handler of the
run
method in the worker and is not "guarded" by further exception handers, so any exception raised in this code crashes the worker process. Therefore I think it is worth fixing this even though the fix is maybe a bit ugly...If you have any other ideas on how to address the issue differently thenI'm all ears and willing to change this PR or contribute a different PR 🙂