Commit Graph

30 Commits

Author SHA1 Message Date
Ben Newman
f5821c88ee Allow server-side method implementations to return a Promise.
This does not mean that Meteor.call or Meteor.apply now return a Promise.
Completion of the method call is merely delayed until the Promise is
resolved or rejected, at which point the calling code asynchronously
receives the resulting value or exception.

These changes were inspired by this forum thread:
https://forums.meteor.com/t/fibers-and-meteor-promise-npm-pacakge/6531/7
2015-08-17 14:05:21 -04:00
David Greenspan
eb76d56ebf Remove spurious dependencies on logging package
We've been shipping the `logging` package to the client even though it
isn't used on the client by any core packages.  Now that the `logging`
package is removable from your app, let's make it actually removable
by deleting totally worthless dependencies that exist for bizarre
historical reasons.

For example, some packages, like `reload` and `mongo`, depend on
`logging` because that's where `Meteor._debug` used to be, before it
was moved to the `meteor` package and `logging` was repurposed for
something else.  The `ddp-server` package had a crazy overreaching set
of dependencies, pulling in a bunch of client-side libraries even though
it only has server-side code of its own.
2015-08-04 16:37:13 -07:00
David Greenspan
db8308672a Remove JSON package
JSON support is in all browsers we could conceivably care about; it's
ES5 and has perfect support in IE 8.  No need to ship a library as
a core package, and no need to specify dependencies on it.

We could conceivably publish a new version of the `json` package that
is empty, so that apps using packages that still say `use("json")`
also get the code size reduction, but we'll wait until someone requests
that.
2015-08-04 16:37:13 -07:00
Slava Kim
bdd3ef6686 bump versions for PLUGINS-PREVIEW@2 2015-07-27 09:45:22 -07:00
David Glasser
43b4b30205 Release PLUGINS-PREVIEW@1
This included removing some internal version constraints. It would be
nice if package A could say "use B@2.0.0" (when both have changed), but
when they're both in the release, we need to make a release that has a
B@2.0.0-rc in it, which doesn't match that constraint. Fortunately,
constraints aren't necessary within a release anyway.
2015-07-22 23:19:11 -07:00
Anubhav Jain
432bc5b61b Fixed ipAddr -> clientAddress and added tests to ensure testing for existence of clientAddress 2015-07-22 09:52:10 -07:00
Anubhav Jain
b83427e369 Updated DDPRateLimiter Tests thanks to Avi!
Modified testing to be extensible and easy to modify and more thorough
Refactored common code into ddp-rate-limiter-tests-common.js
Explicitly defined timeToReset to be passed back to user from livedata_server.js and appended to error object
2015-07-22 09:52:10 -07:00
Anubhav Jain
6a525fbea7 Updated DDPRateLimiter structure per Avi's suggestions and modified tests.
Updated documentation and default rate limit as well.
2015-07-22 09:52:10 -07:00
Anubhav Jain
4cc907f7e4 Updating docs and fixing code review comments. 2015-07-22 09:52:09 -07:00
Anubhav Jain
26f612cb0b Moving DDPRateLimiter to a weak dependency to minimize dependencies on DDP 2015-07-22 09:52:09 -07:00
Anubhav Jain
ac1e0355c5 Added in per connection id rule as default, instead of per IP. Removed a console.log 2015-07-22 09:52:08 -07:00
Anubhav Jain
817ed2904e Added comments and DocBlockr api docs.
Updated DDPRateLimiter's default rule to contain password resets and create new users. Changed valid to allowed in rateLimitResult replies.
2015-07-22 09:52:08 -07:00
Anubhav Jain
7a298ef0d6 Fixed changes from code review and created new Rule class.
Refactored rate-limit package to have a new rule class that organizes the rule attributes appropriately.
Moved all the Rule specific methods from RateLimiter to the Rule prototype. Reformatted code to match Meteor
code style.
2015-07-22 09:52:07 -07:00
Anubhav Jain
03f21b3bb3 Removed dead code and fixed ddp-rate-limiter package.
Cleaned up rate-limit package to remove old methods before refactor. Renamed private
variables inside rate-limit package. Updated livedata_server.js to include rate limiting
for both methods and subscriptions in their respective protocol_handlers. Currently no default
rule for subscriptions in the global DDPRateLimiter.Fixed ddp-rate-limiter tests to work as well.
2015-07-22 09:52:07 -07:00
Anubhav Jain
2fd1c35da1 Generalized rate-limit package and updated livedata_server.js to accept rules on methods and subscriptions.
Need to add checks and throw errors if wrong format / input to rate-limit package. Updated default rule in ddp-rate-limiter
to reflect new rate-limit generic design and moved the location of the DDPRateLimiter in livedata_server.js. Need to fix tests
for both ddp-rate-limiter and rate-limit packages with updated code and clean up rate-limit package.
2015-07-22 09:52:07 -07:00
Anubhav Jain
3e342e04eb Refactored rate-limit package.
Changed rate-limit package to take generic rules and match generic inputs to those rules.
Now, users can use the rate-limit package for whatever they would like. Tests still need to
be updated and need to change location of ddp-rate-limiter to include subscriptions.
Need to remove duplicate code in rate-limit from previous implementation which hardcoded DDP types
into the rate limiting package by making the input be a DDPCommon.MethodInvocation object.
2015-07-22 09:52:07 -07:00
Anubhav Jain
239f806c7d Code cleanup including 80 character limit formatting and refactoring.
Refactored rate-limit.js to remove duplicate code.
Removed commented out code and extra whitespace.
2015-07-22 09:52:07 -07:00
Anubhav Jain
9afcf90503 Fixed line wraps and some basic styling. 2015-07-22 09:52:07 -07:00
Anubhav Jain
b999270ae1 Created default DDPRateLimiter and updated DDPServer to include a rate limiter.
DDPRateLimiter is a global rate limiter with a public API to add rules, set the default
error message and an option to pass in a configuration of rules. It is integrated into
DDP already to check on every method invocation.
2015-07-22 09:52:06 -07:00
Oleksandr Chekhovskyi
565fa39037 Catch up to oplog at most once per write fence
Before this change, number of catch-up attempts was N*M, where N is number of
writes inside of the fence, and M is number of active observers on affected collections.
Every catch up issues yet another query to find the latest oplog entry.

It was extremely inefficient, in terms of both CPU usage and added latency.
After executing write-heavy methods, application process was occupied for many seconds
doing the same thing over and over again.

This change provides a performance improvement for all kinds of workloads.
2015-07-09 09:25:56 -07:00
Graham Hughes
3a3fd7ec35 Halve heartbeat interval.
The changes to use a regularly scheduled timer rather than tearing them
down and setting them back up again mean that the following could occur:

- ping/pong occurs
- server sends packet, acked (so `_seenPacket` is true)
- connection dies
- interval timer picks up, notices `_seenPacket` is true, sets it to
  false, continues
- interval timer picks up, finally notices `_seenPacket` is false.

That is, it can take up to two interval cycles to detect that a
connection has gone away.  Accordingly, I halve the `heartbeatInterval`
so that we detect the connection has gone away, in the worst possible
case, in the same amount of time.

`heartbeatTimeout`, being a `setTimeout` based function, does not
require similar adjustment.
2015-06-15 14:12:34 -07:00
Graham Hughes
02304dd35d Change livedata to reflect new, single method name 2015-06-15 14:12:34 -07:00
Graham Hughes
e959647864 Add glasser's proposal.
Not done yet, because a) needs tests b) there's some oddness in the
heartbeat logic I want to look at.
2015-06-15 14:12:33 -07:00
Slava Kim
85ca501b7c Merge branch 'minimongo-separation' into devel 2015-06-12 11:33:17 -07:00
Slava Kim
b3096e9366 Extract MongoId into a separate package to reduce the dependencies on minimongo 2015-06-12 11:07:20 -07:00
BraveKenny
f6f5020128 Prevent creation of non-function methods 2015-05-29 13:51:16 -04:00
David Glasser
c48ea4affb webapp and routepolicy need no longer be weak deps 2015-04-14 21:34:46 -07:00
David Glasser
6ede690eaa ddp-server does not use faye-websocket directly
(ddp-client does, and sockjs does use it indirectly)
2015-04-14 21:34:46 -07:00
David Glasser
80384fb522 Update ddp package summaries 2015-04-14 21:34:46 -07:00
Robert Lowe
9096e4670a Resolves: ddp package should be split in two
DDP mitosis
2015-04-14 21:34:46 -07:00