Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.3 #412

Merged
merged 18 commits into from
Nov 26, 2024
Merged

v2.3 #412

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
meteor: [1.12.2, 2.6.1, 2.7.3, 2.8.1, 2.12]
meteor: [1.12.2, 2.8.1, 2.12, 2.15]
redis-version: [4, 5, 6, 7]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}

- name: Setup Meteor
uses: meteorengineer/setup-meteor@v1
uses: meteorengineer/setup-meteor@v2
with:
meteor-release: ${{ matrix.meteor }}
- name: Setup tests
run: |
meteor create --release ${{ matrix.meteor }} --bare test
cd test
meteor npm i --save [email protected] simpl-schema chai
meteor npm i --save [email protected] simpl-schema@1.13.1 chai@4
- name: Test
working-directory: ./test
run: METEOR_PACKAGE_DIRS="../" TEST_BROWSER_DRIVER=puppeteer meteor test-packages --raw-logs --once --driver-package meteortesting:mocha ../
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ npm-debug.log
.idea/

test/
node_modules/
53 changes: 27 additions & 26 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,68 +1,69 @@
[email protected].8
accounts-password@2.3.4
[email protected].11
accounts-password@2.4.0
alanning:[email protected]
aldeed:[email protected]
[email protected]
[email protected].4
[email protected].5
[email protected]
[email protected]
[email protected]
[email protected].1
[email protected].2
[email protected]
check@1.3.2
cultofcoders:redis-oplog@2.2.1
check@1.4.1
cultofcoders:redis-oplog@2.3.0
[email protected]
[email protected].1
[email protected].0
[email protected].0
ddp-server@2.6.2
[email protected].2
[email protected].1
[email protected].1
ddp-server@2.7.1
[email protected]
[email protected]
[email protected].7
[email protected].8
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].5
[email protected].3
[email protected].6
[email protected].4
[email protected]
[email protected]
[email protected]
local-test:cultofcoders:redis-oplog@2.2.1
local-test:cultofcoders:redis-oplog@2.3.0
[email protected]
[email protected].2
[email protected].4
matb33:[email protected]
[email protected].3
[email protected].5
meteortesting:[email protected]
meteortesting:[email protected]
[email protected].3
[email protected].9
modules@0.19.0
[email protected].4
[email protected].10
modules@0.20.0
[email protected]
[email protected].7
[email protected].10
[email protected]
[email protected]
[email protected]
natestrauser:[email protected]
npm-mongo@4.16.0
npm-mongo@4.17.2
[email protected]
practicalmeteor:[email protected]
[email protected]
raix:[email protected]
[email protected]
[email protected]
[email protected].7
[email protected].8
[email protected]
[email protected]
[email protected]
reywood:[email protected]
[email protected]
[email protected]
[email protected].1
[email protected].2
tmeasday:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].5
[email protected].8
[email protected]
zodern:[email protected]
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## CHANGELOG

### 2.3.0

- perf: reduce GC pressure by avoiding EJSON.clone [PR 14](https://github.com/Meteor-Community-Packages/redis-oplog/pull/14) by [@alisnic](https://github.com/alisnic)

### 2.2.1

- Update `alanning:roles` to v3.5.1
Expand Down
13 changes: 7 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

First, thank you for considering contributing to redis-oplog! It's people like you that make the open source community such a great community! 😊

We welcome any type of contribution, not only code. You can help with
We welcome any type of contribution, not only code. You can help with

- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
- **Marketing**: writing blog posts, howto's, printing stickers, ...
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
Expand All @@ -13,7 +14,7 @@ We welcome any type of contribution, not only code. You can help with

## Your First Contribution

Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
Working on your first Pull Request? You can learn how from this _free_ series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).

## Submitting code

Expand All @@ -26,14 +27,16 @@ It is also always helpful to have some context for your pull request. What was t

## Running Tests

### Setup
### Setup

```
meteor create --release 1.12.2 --bare test
cd test
meteor npm i --save [email protected] simpl-schema chai
meteor npm i --save [email protected] simpl-schema chai@4
```

### Start Tests

```
METEOR_PACKAGE_DIRS="../" TEST_BROWSER_DRIVER=puppeteer meteor test-packages --raw-logs --once --driver-package meteortesting:mocha ../
```
Expand All @@ -55,14 +58,12 @@ You can also reach us at [email protected].
Thank you to all the people who have already contributed to redis-oplog!
<a href="graphs/contributors"><img src="https://opencollective.com/redis-oplog/contributors.svg?width=890" /></a>


### Backers

Thank you to all our backers! [[Become a backer](https://opencollective.com/redis-oplog#backer)]

<a href="https://opencollective.com/redis-oplog#backers" target="_blank"><img src="https://opencollective.com/redis-oplog/backers.svg?width=890"></a>


### Sponsors

Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/redis-oplog#sponsor))
Expand Down
5 changes: 3 additions & 2 deletions lib/cache/ObservableCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ export default class ObservableCollection {
* @param safe {Boolean} If this is set to true, it assumes that the object is cleaned
*/
add(doc, safe = false) {
doc = EJSON.clone(doc);

if (!safe) {
if (this.fieldsArray) {
// projection function clones the document already.
doc = this.projectFieldsOnDoc(doc);
} else {
doc = EJSON.clone(doc);
}
}

Expand Down
19 changes: 14 additions & 5 deletions lib/mongo/ObserveMultiplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ export function ObserveMultiplexer(options) {
});
}

function strictFreeze(obj) {
return new Proxy(obj, {
set() {
throw new Error('Cannot mutate a frozen object');
}
});
}
const freezeObject = Meteor.isProduction ? Object.freeze : strictFreeze

Object.assign(ObserveMultiplexer.prototype, {
addHandleAndSendInitialAdds: function(handle) {
var self = this;
Expand Down Expand Up @@ -213,24 +222,25 @@ Object.assign(ObserveMultiplexer.prototype, {
// can continue until these are done. (But we do have to be careful to not
// use a handle that got removed, because removeHandle does not use the
// queue; thus, we iterate over an array of keys that we control.)
const safeArgs = freezeObject(args);

Object.keys(self._handles).forEach(function(handleId) {
var handle = self._handles && self._handles[handleId];
if (!handle) return;
var callback = handle['_' + callbackName];
// clone arguments so that callbacks can mutate their arguments

// We silence out removed exceptions
if (callback === 'removed') {
try {
callback.apply(null, EJSON.clone(args));
callback.apply(null, safeArgs);
} catch (e) {
// Supressing `removed non-existent exceptions`
if (!isRemovedNonExistent(e)) {
throw e;
}
}
} else {
callback && callback.apply(null, EJSON.clone(args));
callback && callback.apply(null, safeArgs);
}
});
});
Expand All @@ -250,8 +260,7 @@ Object.assign(ObserveMultiplexer.prototype, {
self._cache.docs.forEach(function(doc, id) {
if (!_.has(self._handles, handle._id))
throw Error('handle got removed before sending initial adds!');
var fields = EJSON.clone(doc);
delete fields._id;
const { _id, ...fields } = doc
if (self._ordered) add(id, fields, null);
// we're going in order, so add at end
else add(id, fields);
Expand Down
4 changes: 2 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'cultofcoders:redis-oplog',
version: '2.2.1',
version: '2.3.0',
// Brief, one-line summary of the package.
summary: "Replacement for Meteor's MongoDB oplog implementation",
// URL to the Git repository containing the source code for this package.
Expand All @@ -17,7 +17,7 @@ Npm.depends({
});

Package.onUse(function(api) {
api.versionsFrom(['1.12.2', '2.8.1', '2.12']);
api.versionsFrom(['1.12.2', '2.8.1', '2.13', '2.15', '2.16']);
api.use([
'underscore',
'ecmascript',
Expand Down
Loading