Skip to content

Conversation

@brianhanifin
Copy link
Contributor

First, I modified nodeStatic.Server(".") to include a 30 day cache and enabled gzip compression. It may only make a small difference with the .mp3 files, but the js and css files are much smaller when gzipped. I added gzipped versions of the MP3 files (e.g. alert.mp3.gz).

var staticServer = new nodeStatic.Server(".", { cache:2592000, gzip:true }); 

Next, using appcache-node I implemented an "offline" HTML 5 Application Cache. Below is the generated nightscout.appcache file. The "NETWORK:" group defines the files that should never be cached offline. By specifying an asterisk we are saying that no other file should be cached (socket.io won't work if cached for example).

nightscout.appcache

CACHE MANIFEST

CACHE:
http://localhost:1337/audio/alarm.mp3
http://localhost:1337/audio/alarm2.mp3
http://localhost:1337/audio/alarm.mp3.gz
http://localhost:1337/audio/alarm2.mp3.gz
http://localhost:1337/css/dropdown.css
http://localhost:1337/css/main.css
http://localhost:1337/js/client.js
http://localhost:1337/js/dropdown.js
http://localhost:1337/favicon.ico

NETWORK:
*

# Fri Jun 20 2014 17:49:43 GMT-0700 (PDT)

I believe this is proof that the .mp3 files are being cached (showing a 304 Not Modified status). This as screenshot of Live HTTP Headers:

proof

This is my first big stab at contributing. What do you think? I have it working both locally and on a test Azure server.

importing lastest nightscout master code
Trying some experiments to see if I can serve alarm.mp3.gz files
instead of the uncompressed originals.
The .mp3 files will not be sent compressed without this.
changed gzip:'true’… According to the node-static read me this
shouldn’t work, but it works to compress all files.

/audio/alarm.mp3 drops from 587,716 bytes to 4,822!

TEST OUTPUT
macbookpro:audio dev$ curl http://localhost:1337/audio/alarm.mp3
--silent --write-out "%{size_download}\n" --output /dev/null
587716

curl --compress http://localhost:1337/audio/alarm.mp3 --silent
--write-out "%{size_download}\n" --output /dev/null
4822
Added additional instructions to get my.env working.
Used appcache-node to generate a nightscout.appcache file which
includes directives on which files to cache.
@bewest
Copy link
Member

bewest commented Jun 21, 2014

👍 fantastic, thank you!

@bewest
Copy link
Member

bewest commented Jun 21, 2014

You might want to change your mongo db password, if you have not already.

This should help stay under Azure's free quotas.

bewest added a commit that referenced this pull request Jun 21, 2014
@bewest bewest merged commit f46f3a3 into nightscout:master Jun 21, 2014
@brianhanifin
Copy link
Contributor Author

I created a second site on the same Azure account today. Will that cause me a problem?

Here is further proof of the improvement this made. :)
page speed test comparison

@rnpenguin
Copy link
Contributor

Nice.

@bewest should we create the following for nightscout specific:

Build Status
Gitter chat
Dependency Status

@brianhanifin
Copy link
Contributor Author

Oops. I didn't intend to leave those in there. I saw those on another project and thought they were interesting services, so I was experimenting with them.

Gitter chat This provides a project chatroom. I was wondering if that would be useful for us to discuss issues outside of the issue tracker and Facebook group.

Build Status I'm not sure if I am taking full advantage of this, but it is supposed to warn you of errors.

Dependency Status This service lets you know if your dependancies have newer versions.

@bewest
Copy link
Member

bewest commented Jun 21, 2014

Yes. These look good.
Travis isn't doing anything ATM, but it would not be hard for someone to
add a test and is worth keeping.

On Fri, Jun 20, 2014 at 6:56 PM, rnpenguin [email protected] wrote:

Nice.

@bewest https://github.com/bewest should we create the following for
nightscout specific:

[image: Build Status]
https://travis-ci.org/brianhanifin/cgm-remote-monitor
[image: Gitter chat] https://gitter.im/brianhanifin/cgm-remote-monitor
[image: Dependency Status]
https://david-dm.org/brianhanifin/cgm-remote-monitor


Reply to this email directly or view it on GitHub
#16 (comment)
.

@rnpenguin
Copy link
Contributor

Agree. Should we set it up for nightscout specifically though

@bewest
Copy link
Member

bewest commented Jun 21, 2014

I turned on travis just now.

@bewest
Copy link
Member

bewest commented Jun 21, 2014

https://david-dm.org/nightscout/cgm-remote-monitor - I'm not crazy about this one, we pinned down socket.io on purpose. It'd be pretty cool if instead, they measured whether or not the dependency chain is precise and can be resolved rather than how old they are.

@bewest
Copy link
Member

bewest commented Jun 21, 2014

Gitter chat

@rnpenguin
Copy link
Contributor

:).

That would be better, I need to look into it a bit more.

@brianhanifin
Copy link
Contributor Author

You can't have a chatroom at your username, but you can create a custom chat room named dev for example. Oh look, you can shorten the title on the badge, and still link to a longer chat room name.

Gitter chat

[![Gitter chat](https://badges.gitter.im/nightscout.png)](https://gitter.im/nightscout/dev)

@brianhanifin
Copy link
Contributor Author

Oh, and I changed the password. Thanks for the reminder.

@jwedding
Copy link
Contributor

Guys, I think I tried to pull in the wrong direction. Please ignore/cancel that request. I'll have to do this when I'm paying better attention.

@brianhanifin brianhanifin deleted the feature/cache branch June 24, 2014 23:47
@robynec75
Copy link

I think I hit my limit because of an alarm running on an open window on the computer while we were out today. Can I get some help in adding this caching behavior to mine? Thanks!

@brianhanifin
Copy link
Contributor Author

This version of the code didn't quite have the effect we were hoping for. I have a new branch that is about ready, and caches the mp3 files really well. You can merge this into your copy. Go to the link below, and create a pull request to your master branch (make sure your branch is on the left, and mine is on the right).

https://github.com/brianhanifin/cgm-remote-monitor/express-cache

@robynec75
Copy link

How do I create a pull request? Also when I clicked on the link I get a 404 error. I just did my setup yesterday so this will be my first update of any kind and I don't really know how to do it. Thanks!

@brianhanifin
Copy link
Contributor Author

brianhanifin_cgm-remote-monitor_at_express-cache

@robynec75
Copy link

Thanks! I'm pretty sure i did it right.
pull merge

PieterGit pushed a commit that referenced this pull request Feb 2, 2019
mrspouse pushed a commit to mrspouse/cgm-remote-monitor that referenced this pull request Apr 3, 2022
mrspouse pushed a commit to mrspouse/cgm-remote-monitor that referenced this pull request Apr 3, 2022
justinthomas pushed a commit to justinthomas/cgm-remote-monitor that referenced this pull request Nov 29, 2022
Ki-ches added a commit to Ki-ches/cgm-remote-monitor that referenced this pull request Jun 20, 2024
psonnera pushed a commit to psonnera/cgm-remote-monitor that referenced this pull request Oct 18, 2025
feat(ai-eval): Add 14-day limit to AI evaluation report
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants