Select the random row function based on DB driver.
This commit is contained in:
parent
511ee12a58
commit
efb66f7c1e
3 changed files with 22 additions and 2 deletions
|
@ -7,7 +7,7 @@ from gzip import GzipFile
|
|||
|
||||
from data import model
|
||||
from data.archivedlogs import JSON_MIMETYPE
|
||||
from data.database import RepositoryBuild
|
||||
from data.database import RepositoryBuild, db_random_func
|
||||
from app import build_logs, log_archive
|
||||
from util.streamingjsonencoder import StreamingJSONEncoder
|
||||
|
||||
|
@ -22,7 +22,7 @@ def archive_redis_buildlogs():
|
|||
avoid needing two-phase commit. """
|
||||
try:
|
||||
# Get a random build to archive
|
||||
to_archive = model.archivable_buildlogs_query().order_by(fn.Random()).get()
|
||||
to_archive = model.archivable_buildlogs_query().order_by(db_random_func()).get()
|
||||
logger.debug('Archiving: %s', to_archive.uuid)
|
||||
|
||||
length, entries = build_logs.get_log_entries(to_archive.uuid, 0)
|
||||
|
|
Reference in a new issue