Skip to content

Commit

Permalink
5 minutes cache instead of one hour
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo-Duke committed May 3, 2024
1 parent 766fa4a commit 577bc24
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/api/customObservations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function fetchObservations(): Promise<Observation[]> {
const res = await fetch(
`${process.env.apiHost}/api/portal/fr/${process.env.portal}/custom-contribution-types/`,
{
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
headers: {
Accept: 'application/json',
},
Expand All @@ -49,7 +49,7 @@ async function fetchObservation(id: string): Promise<Observation | null> {
const res = await fetch(
`${process.env.apiHost}/api/portal/fr/${process.env.portal}/custom-contribution-types/${id}`,
{
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
headers: {
Accept: 'application/json',
},
Expand All @@ -67,7 +67,7 @@ async function fetchObservationDetails(
const res = await fetch(
`${process.env.apiHost}/api/portal/fr/${process.env.portal}/custom-contribution-types/${id}/contributions`,
{
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
headers: {
Accept: 'application/json',
},
Expand Down
2 changes: 1 addition & 1 deletion src/api/details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getDetailsUrl } from './settings';

async function fetchDetails(url: string) {
const res = await fetch(`${process.env.apiHost}${url}`, {
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
headers: {
Accept: 'application/json',
},
Expand Down
2 changes: 1 addition & 1 deletion src/api/geojson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GeoJSON } from 'geojson';

async function fetchGeoJSON(url: string) {
const res = await fetch(`${process.env.apiHost}${url}`, {
next: { revalidate: 60 * 60 },
next: { revalidate: 20 * 60 },
});
if (res.status < 200 || res.status > 299) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/api/observations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function fetchObservation() {
const res = await fetch(
`${process.env.apiHost}/api/portal/fr/${process.env.portal}/contributions/json_schema/`,
{
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
headers: {
Accept: 'application/json',
},
Expand Down
2 changes: 1 addition & 1 deletion src/api/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Menu, getMenuSettings } from './settings';

async function fetchDetails(url: string) {
const res = await fetch(`${process.env.apiHost}${url}`, {
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
headers: {
Accept: 'application/json',
},
Expand Down
2 changes: 1 addition & 1 deletion src/api/poi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function fetchPois({ params }: FetchPoisProps = {}): Promise<Poi[]> {
headers: {
Accept: 'application/json',
},
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
});
if (res.status < 200 || res.status > 299) {
return [];
Expand Down
2 changes: 1 addition & 1 deletion src/api/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export async function fetchSettings(): Promise<RawSettings> {
const res = await fetch(
`${process.env.apiHost}/api/portal/fr/portal/${process.env.portal}/`,
{
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
headers: {
Accept: 'application/json',
},
Expand Down
6 changes: 3 additions & 3 deletions src/api/stations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function fetchStations(): Promise<Station[]> {
headers: {
Accept: 'application/json',
},
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
});
if (res.status < 200 || res.status > 299) {
return [];
Expand All @@ -39,7 +39,7 @@ async function fetchStation(id: number): Promise<Station | null> {
headers: {
Accept: 'application/json',
},
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
});
if (res.status < 200 || res.status > 299) {
return null;
Expand All @@ -55,7 +55,7 @@ async function fetchStationObservations(
headers: {
Accept: 'application/json',
},
next: { revalidate: 60 * 60 },
next: { revalidate: 5 * 60 },
});
if (res.status < 200 || res.status > 299) {
return null;
Expand Down

0 comments on commit 577bc24

Please sign in to comment.