@@ -7,7 +7,7 @@ use buildomat_client::prelude::*;
77use buildomat_common:: * ;
88use buildomat_download:: RequestContextEx ;
99use buildomat_github_database:: types:: * ;
10- use buildomat_sse:: { HeaderMapEx , ServerSentEvents } ;
10+ use buildomat_sse:: HeaderMapEx ;
1111use chrono:: prelude:: * ;
1212use dropshot:: {
1313 endpoint, ConfigDropshot , HttpError , HttpResponseOk , RequestContext ,
@@ -309,7 +309,7 @@ async fn details(
309309 * The <style> tag needs to appear inside the <head>:
310310 */
311311 out += "<style>\n " ;
312- out += & app. templates . load ( "variety/basic/style.css" ) ?;
312+ out += & app. templates . load ( "variety/basic/www/ style.css" ) ?;
313313 out += "</style>\n " ;
314314 }
315315 out += "</head>\n " ;
@@ -381,41 +381,6 @@ async fn details_live(
381381 let path = path. into_inner ( ) ;
382382 let query = query. into_inner ( ) ;
383383
384- /*
385- * The "Last-Event-ID" header will be sent by a browser when reconnecting,
386- * with the "id" field of the last event it saw in the previous stream. The
387- * event stream for this endpoint is a mixture of job events, which have a
388- * well-defined sequence number, and status change events, which do not.
389- *
390- * We include in each ID value the sequence number of the most recently sent
391- * job event, so that we can always seek to the right point in the events
392- * for the job. This may lead to more than one event with the same sequence
393- * number, but that doesn't appear to be a problem in practice.
394- *
395- * Note that this value must take precedence over the query parameter, as a
396- * resumed stream from the browser will, each time it reconnects, include
397- * the original query string we gave to the EventSource. It will only
398- * include the header on subsequent retries once it has seen at least one
399- * event.
400- */
401- let mut minseq = None ;
402- if let Some ( lei) = rc. request . headers ( ) . last_event_id ( ) {
403- if let Some ( num) = lei. strip_prefix ( "seq-" ) {
404- if let Ok ( lei_seq) = num. parse :: < u32 > ( ) {
405- if let Some ( lei_seq) = lei_seq. checked_add ( 1 ) {
406- /*
407- * Resume the event stream from this earlier point.
408- */
409- minseq = Some ( lei_seq) ;
410- }
411- }
412- }
413- }
414-
415- if minseq. is_none ( ) {
416- minseq = query. minseq ;
417- }
418-
419384 let load = match path. load ( & rc) {
420385 Ok ( Some ( load) ) => load,
421386 Ok ( None ) => return html_404 ( false ) ,
@@ -425,28 +390,26 @@ async fn details_live(
425390 }
426391 } ;
427392
428- let mut sse = ServerSentEvents :: default ( ) ;
429- let response = match sse. to_response ( ) {
430- Ok ( response) => response,
431- Err ( e) => {
432- error ! ( rc. log, "details live: sse: {e}" ) ;
433- return html_500 ( & rc. request_id , false ) ;
434- }
435- } ;
436-
437- let ok = match load. cr . variety {
393+ let res = match load. cr . variety {
438394 CheckRunVariety :: Basic => {
439- variety:: basic:: live ( app, & load. cs , & load. cr , minseq, sse) . await
395+ variety:: basic:: live (
396+ app,
397+ & load. cs ,
398+ & load. cr ,
399+ rc. request . headers ( ) . last_event_id ( ) ,
400+ query. minseq ,
401+ )
402+ . await
440403 }
441404 /*
442405 * No other variety exposes live details:
443406 */
444- _ => Ok ( false ) ,
407+ _ => Ok ( None ) ,
445408 } ;
446409
447- match ok {
448- Ok ( true ) => Ok ( response ) ,
449- Ok ( false ) => html_404 ( false ) ,
410+ match res {
411+ Ok ( Some ( res ) ) => Ok ( res ) ,
412+ Ok ( None ) => html_404 ( false ) ,
450413 Err ( e) => {
451414 error ! ( rc. log, "details live: {e}" ) ;
452415 html_500 ( & rc. request_id , false )
0 commit comments