fix cpu limit exceeded, update README

pull/8/head
lyc8503 2024-01-30 14:06:21 +08:00
parent 31a4d9345a
commit 092140b962
3 changed files with 13 additions and 5 deletions

View File

@ -8,7 +8,7 @@ Another **serverless (and free!)** uptime monitoring & status page on Cloudflare
#### Monitoring #### Monitoring
- Up to 50 **2-minute** interval check on free plan (Up to unlimited 1-min check on paid Workers plan) - Up to 50 **2-minute** interval check
- **Geo-specific checks** from more than [310 cities](https://www.cloudflare.com/network/) around the world - **Geo-specific checks** from more than [310 cities](https://www.cloudflare.com/network/) around the world
- Monitoring for **HTTP/HTTPS/TCP port** - Monitoring for **HTTP/HTTPS/TCP port**
- Up to 90-day uptime history and uptime percentage - Up to 90-day uptime history and uptime percentage
@ -37,7 +37,8 @@ Please refer to [Quickstart](https://github.com/lyc8503/UptimeFlare/wiki/Quickst
## TODOs ## TODOs
- [ ] SSL certificate checks - [x] TCP `opened` promise
- [x] ~~SSL certificate checks~~
- [ ] Slack / Telegram webhook example - [ ] Slack / Telegram webhook example
- [ ] Incident timeline - [ ] Incident timeline
- [ ] Email notification via Cloudflare Email Workers - [ ] Email notification via Cloudflare Email Workers

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 KiB

After

Width:  |  Height:  |  Size: 678 KiB

View File

@ -13,12 +13,17 @@ export const runtime = 'experimental-edge'
const inter = Inter({ subsets: ['latin'] }) const inter = Inter({ subsets: ['latin'] })
export default function Home({ export default function Home({
state, state: stateStr,
monitors, monitors,
}: { }: {
state: MonitorState state: string
monitors: MonitorTarget[] monitors: MonitorTarget[]
}) { }) {
let state;
if (stateStr !== undefined) {
state = JSON.parse(stateStr) as MonitorState
}
return ( return (
<> <>
<Head> <Head>
@ -70,7 +75,9 @@ export async function getServerSideProps() {
const { UPTIMEFLARE_STATE } = process.env as unknown as { const { UPTIMEFLARE_STATE } = process.env as unknown as {
UPTIMEFLARE_STATE: KVNamespace UPTIMEFLARE_STATE: KVNamespace
} }
const state = (await UPTIMEFLARE_STATE?.get('state', 'json')) as unknown as MonitorState
// Read state as string from KV, to avoid hitting server-side cpu time limit
const state = (await UPTIMEFLARE_STATE?.get('state')) as unknown as MonitorState
// Only present these values to client // Only present these values to client
const monitors = workerConfig.monitors.map((monitor) => { const monitors = workerConfig.monitors.map((monitor) => {