| Provider | Singleton | Instantiable | Configurable |
|---|---|---|---|
| Constant | Yes | No | No |
| Value | Yes | No | No |
| Service | Yes | No | No |
| Factory | Yes | Yes | No |
| Decorator | Yes | No? | No |
| Provider | Yes | Yes | Yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To disable socket.io, disable the sockets hook (you'll have to disable the pubsub hook as well) | |
| // This is a replacement for the default app.js file: | |
| require('sails').lift({ | |
| hooks: { | |
| sockets: false, | |
| pubsub: false | |
| } |
On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:
2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files)
2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...
An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.
- * Instead of using
suto runulimiton the nginx account, useps aux | grep nginxto locate nginx's process IDs. Then query each process's file handle limits usingcat /proc/pid/limits(wherepidis the process id retrieved fromps). (Note:sudomay be necessary on your system for thecatcommand here, depending on your system.) - Added
fs.file-max = 70000to /etc/sysctl.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function extract(mv){ | |
| //NodeIterators are really cool: https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator | |
| var nodeIterator = document.createNodeIterator( | |
| mv.getBodyElement(), | |
| NodeFilter.SHOW_ELEMENT, | |
| { | |
| acceptNode: function(node){ | |
| //this is the main function where the interesting code occurs | |
| //because node iterator is a recursive tree walk you'll see every node below the body element | |
| //this includes nodes that contain both the html we want, and html we don't want |
OlderNewer