File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { isAbsolute, join } from "path/mod.ts";
2
2
3
3
import { RenderResult } from "../../command/render/types.ts" ;
4
4
import { md5Hash } from "../../core/hash.ts" ;
5
+ import { isJupyterNotebook } from "../../core/jupyter/jupyter.ts" ;
5
6
import { PromiseQueue } from "../../core/promise.ts" ;
6
7
import { projectOutputDir } from "../project-shared.ts" ;
7
8
import { ProjectContext } from "../types.ts" ;
@@ -71,9 +72,18 @@ export class ServeRenderManager {
71
72
return hash ;
72
73
}
73
74
} , "" ) ;
74
- return md5Hash ( Deno . readTextFileSync ( file ) ) +
75
- md5Hash ( Deno . readTextFileSync ( inputFile ) ) +
76
- resourceHash ;
75
+ // very large jupyter notebooks can take a long time to hash
76
+ // (~ 2 seconds for every 10mb) so we use the slightly less
77
+ // robust file modification time in that case
78
+ if ( isJupyterNotebook ( inputFile ) ) {
79
+ return String ( Deno . statSync ( file ) . mtime ) +
80
+ String ( Deno . statSync ( inputFile ) . mtime ) +
81
+ resourceHash ;
82
+ } else {
83
+ return md5Hash ( Deno . readTextFileSync ( file ) ) +
84
+ md5Hash ( Deno . readTextFileSync ( inputFile ) ) +
85
+ resourceHash ;
86
+ }
77
87
}
78
88
79
89
private fileRenders_ = new Map < string , string > ( ) ;
Original file line number Diff line number Diff line change @@ -220,7 +220,9 @@ export async function serveProject(
220
220
) as string [ ] ) ;
221
221
222
222
// render manager for tracking need to re-render outputs
223
+ // (record any files we just rendered)
223
224
const renderManager = new ServeRenderManager ( ) ;
225
+ renderManager . onRenderResult ( renderResult , resourceFiles , project ) ;
224
226
225
227
// function that can return the current target pdf output file
226
228
const pdfOutputFile = ( finalOutput && pdfOutput )
You can’t perform that action at this time.
0 commit comments