~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH builds.sr.ht 1/2] Prefetch job tasks even if search fails

Details
Message ID
<20210402111938.183754-1-me@ignaskiela.eu>
DKIM signature
pass
Download raw message
Patch: +2 -2
---
 buildsrht/blueprints/jobs.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/buildsrht/blueprints/jobs.py b/buildsrht/blueprints/jobs.py
index 6f092ff..a2051ce 100644
--- a/buildsrht/blueprints/jobs.py
@@ -104,11 +104,11 @@ def jobs_page(jobs, sidebar="sidebar.html", **kwargs):
    search_error = None

    try:
        jobs = (get_jobs(jobs, search)
            .options(sa.orm.joinedload(Job.tasks)))
        jobs = (get_jobs(jobs, search))
    except ValueError as ex:
        search_error = str(ex)

    jobs = jobs.options(sa.orm.joinedload(Job.tasks))
    jobs, pagination = paginate_query(jobs)
    return render_template("jobs.html",
        jobs=jobs, status_map=status_map, icon_map=icon_map, tags=tags,
-- 
2.25.1

[PATCH builds.sr.ht] Improve RSS feed generation speed

Details
Message ID
<20210402112304.184632-1-me@ignaskiela.eu>
In-Reply-To
<20210402111938.183754-1-me@ignaskiela.eu> (view parent)
DKIM signature
pass
Download raw message
Patch: +4 -5
url_for is surprisingly slow, lxml is significantly faster for large
feeds, and joinedload, while technically not necessary, did give me an
improvement on large feeds for some reason.
---
Side note: Pyroscope(https://github.com/pyroscope-io/pyroscope) was a great help
for making this patch, maybe consider using it to profile sr.ht infrastructure?

 buildsrht/blueprints/jobs.py | 1 +
 buildsrht/rss.py             | 8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/buildsrht/blueprints/jobs.py b/buildsrht/blueprints/jobs.py
index a2051ce..8091921 100644
--- a/buildsrht/blueprints/jobs.py
@@ -126,6 +126,7 @@ def jobs_feed(jobs, title, endpoint, **urlvalues):
    if terms is not None:
        urlvalues["search"] = terms
    link = origin + url_for(endpoint, **urlvalues)
    jobs=jobs.options(sa.orm.joinedload(Job.owner))
    return generate_feed(jobs, title, link, description)

badge_success = """
diff --git a/buildsrht/rss.py b/buildsrht/rss.py
index 34521e0..aae3c67 100644
--- a/buildsrht/rss.py
@@ -1,4 +1,4 @@
import xml.etree.ElementTree as ET
import lxml.etree as ET
from flask import Response, url_for
from srht.config import cfg

@@ -15,11 +15,10 @@ def generate_feed(jobs, title, link, description):
    ET.SubElement(channel, "language").text = "en"

    for job in jobs:
        element = ET.Element("item")
        element = ET.SubElement(channel, "item")
        title, description = f"#{job.id} ({job.status.name})", job.note
        author = job.owner.username
        url = ORIGIN + url_for(
            "jobs.job_by_id", username=job.owner.username, job_id=job.id)
        url = f"{ORIGIN}/{author}/{job.id}"
        time = job.updated.strftime(RFC_822_FORMAT)
        ET.SubElement(element, "title").text = title
        if description:
@@ -28,7 +27,6 @@ def generate_feed(jobs, title, link, description):
        ET.SubElement(element, "link").text = url
        ET.SubElement(element, "guid").text = url
        ET.SubElement(element, "pubDate").text = time
        channel.append(element)

    xml = ET.tostring(root, encoding="UTF-8")
    return Response(xml, mimetype='application/rss+xml')
-- 
2.25.1

[builds.sr.ht/patches] build success

builds.sr.ht
Details
Message ID
<CAD7A6EF9JPT.OQ89XGQNFZ2D@cirno2>
In-Reply-To
<20210402112304.184632-1-me@ignaskiela.eu> (view parent)
DKIM signature
missing
Download raw message
builds.sr.ht/patches: SUCCESS in 2m45s

[Prefetch job tasks even if search fails][0] from [Ignas Kiela][1]

[0]: https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/21739
[1]: mailto:me@ignaskiela.eu

✓ #475385 SUCCESS builds.sr.ht/patches/archlinux.yml https://builds.sr.ht/~sircmpwn/job/475385
✓ #475386 SUCCESS builds.sr.ht/patches/debian.yml    https://builds.sr.ht/~sircmpwn/job/475386
✓ #475384 SUCCESS builds.sr.ht/patches/alpine.yml    https://builds.sr.ht/~sircmpwn/job/475384

Re: [PATCH builds.sr.ht] Improve RSS feed generation speed

Details
Message ID
<CAIC3HNJ4Z4D.QMY8IG6M7HP0@taiga>
In-Reply-To
<20210402112304.184632-1-me@ignaskiela.eu> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks!

To git@git.sr.ht:~sircmpwn/builds.sr.ht
   e5d07a8..81a5f43  master -> master
Reply to thread Export thread (mbox)