Skip to content

Commit 7b805fd

Browse files
ctruedenclaude
andcommitted
Avoid rate limits by loading badges more slowly
I'm not confident this is actually necessary. TBD! Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 42ce2d4 commit 7b805fd

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/pombast/status/_query.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,7 @@ def _make_ci_html(
100100
return ""
101101
slug = project_url[len("https://github.com/") :]
102102
wf = _ensure_yaml_ext(workflow if isinstance(workflow, str) else default_workflow)
103-
return (
104-
f'<td class="ci" data-slug="{slug}">'
105-
f'<a href="https://github.com/{slug}/actions">'
106-
f'<img src="https://github.com/{slug}/actions/workflows/{wf}/badge.svg">'
107-
f"</a></td>"
108-
)
103+
return f'<td class="ci" data-slug="{slug}" data-wf="{wf}"></td>'
109104

110105

111106
def _scm_project_url(ctx, group_id: str, artifact_id: str, version: str) -> str:

src/pombast/status/templates/status.html.j2

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,23 @@ td.smelt.has-log:hover { filter: brightness(1.3); }
6969
(function(){
7070
fetch('badges.json').then(function(r){return r.json();}).then(function(d){
7171
var repos=d.repos||{};
72-
document.querySelectorAll('td.ci[data-slug]').forEach(function(td){
73-
var entry=repos[td.dataset.slug];
74-
if(!entry)return;
75-
var title=typeof entry==='string'?entry:entry.title;
76-
var workflow=typeof entry==='string'?null:entry.workflow;
77-
if(!title)return;
78-
td.setAttribute('sorttable_customkey',
72+
var tds=Array.from(document.querySelectorAll('td.ci[data-slug]'));
73+
tds.forEach(function(td,i){
74+
var slug=td.dataset.slug;
75+
var entry=repos[slug];
76+
var title=entry?(typeof entry==='string'?entry:entry.title):null;
77+
var wf=entry?(typeof entry==='string'?null:entry.workflow):null;
78+
if(!wf)wf=td.dataset.wf;
79+
if(title)td.setAttribute('sorttable_customkey',
7980
title.indexOf('passing')>=0?'1':title.indexOf('failing')>=0?'2':'3');
80-
if(workflow){
81-
var img=td.querySelector('img');
82-
if(img)img.src='https://github.com/'+td.dataset.slug+'/actions/workflows/'+workflow+'/badge.svg';
83-
}
81+
setTimeout(function(){
82+
var a=document.createElement('a');
83+
a.href='https://github.com/'+slug+'/actions';
84+
var img=document.createElement('img');
85+
img.src='https://github.com/'+slug+'/actions/workflows/'+wf+'/badge.svg';
86+
a.appendChild(img);
87+
td.appendChild(a);
88+
},i*40);
8489
});
8590
}).catch(function(){});
8691
})();

0 commit comments

Comments
 (0)