File tree Expand file tree Collapse file tree
front/src/pods/embalse-search Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6262 publish-profile : ${{ secrets.AZURE_FRONT_PUBLISH_PROFILE }}
6363 images : ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
6464 restart : true
65+
66+ # Warm-up: force ISR regeneration so first real user gets data
67+ - name : Warm-up (force ISR regeneration)
68+ run : |
69+ echo "Waiting for App Service to start..."
70+ sleep 30
71+ curl -s -o /dev/null -w "%{http_code}" https://info-embalse-front-prod-ecguababcfdsepga.westeurope-01.azurewebsites.net/
72+ echo " - Warm-up done, ISR regeneration triggered"
Original file line number Diff line number Diff line change @@ -4,27 +4,34 @@ import { getDb } from "@/lib/mongodb";
44import type { Embalse } from "./api/api.model" ;
55
66export async function getEmbalsesFromDb ( ) : Promise < Embalse [ ] > {
7- const db = await getDb ( ) ;
8- const docs = await db
9- . collection ( "embalses" )
10- . find (
11- { } ,
12- {
13- projection : {
14- _id : 1 ,
15- nombre : 1 ,
16- provincia : 1 ,
17- slug : 1 ,
7+ try {
8+ const db = await getDb ( ) ;
9+ const docs = await db
10+ . collection ( "embalses" )
11+ . find (
12+ { } ,
13+ {
14+ projection : {
15+ _id : 1 ,
16+ nombre : 1 ,
17+ provincia : 1 ,
18+ slug : 1 ,
19+ } ,
1820 } ,
19- } ,
20- )
21- . toArray ( ) ;
21+ )
22+ . toArray ( ) ;
2223
23- return docs . map ( ( doc ) => ( {
24- _id : doc . slug ?? createSlug ( doc . nombre ?? "" ) ,
25- nombre : doc . nombre ?? "" ,
26- provincia : doc . provincia ?? "" ,
27- } ) ) ;
24+ return docs . map ( ( doc ) => ( {
25+ _id : doc . slug ?? createSlug ( doc . nombre ?? "" ) ,
26+ nombre : doc . nombre ?? "" ,
27+ provincia : doc . provincia ?? "" ,
28+ } ) ) ;
29+ } catch {
30+ console . warn (
31+ "getEmbalsesFromDb: MongoDB not available (build time?), returning empty array"
32+ ) ;
33+ return [ ] ;
34+ }
2835}
2936
3037const createSlug = ( nombre : string ) : string => {
You can’t perform that action at this time.
0 commit comments