Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 51fde98

Browse files
authored
Merge pull request #3898 from withspectrum/2.4.34
2.4.34
2 parents d592692 + 30980e2 commit 51fde98

File tree

28 files changed

+189
-271
lines changed

28 files changed

+189
-271
lines changed

analytics/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"bull": "3.3.10",
1010
"node-env-file": "^0.1.8",
1111
"now-env": "^3.1.0",
12-
"raven": "^2.6.3",
12+
"raven": "^2.6.4",
1313
"rethinkdbdash": "^2.3.29",
1414
"sha1": "^1.1.1",
1515
"source-map-support": "^0.5.9",

analytics/yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,15 +302,15 @@ qs@^6.5.1:
302302
version "6.5.2"
303303
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
304304

305-
raven@^2.6.3:
306-
version "2.6.3"
307-
resolved "https://registry.yarnpkg.com/raven/-/raven-2.6.3.tgz#207475a12809277ef54eaceafe2597ff65262ab4"
305+
raven@^2.6.4:
306+
version "2.6.4"
307+
resolved "https://registry.yarnpkg.com/raven/-/raven-2.6.4.tgz#458d4a380c8fbb59e0150c655625aaf60c167ea3"
308308
dependencies:
309309
cookie "0.3.1"
310310
md5 "^2.2.1"
311311
stack-trace "0.0.10"
312312
timed-out "4.0.1"
313-
uuid "3.0.0"
313+
uuid "3.3.2"
314314

315315
readable-stream@^2.3.5:
316316
version "2.3.6"
@@ -401,9 +401,9 @@ util-deprecate@~1.0.1:
401401
version "1.0.2"
402402
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
403403

404-
uuid@3.0.0:
405-
version "3.0.0"
406-
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.0.tgz#6728fc0459c450d796a99c31837569bdf672d728"
404+
uuid@3.3.2:
405+
version "3.3.2"
406+
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
407407

408408
uuid@^3.1.0:
409409
version "3.2.1"

api/index.js

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,33 @@ import createSubscriptionsServer from './routes/create-subscription-server';
9494
const subscriptionsServer = createSubscriptionsServer(server, '/websocket');
9595

9696
// Start API wrapped in Apollo Engine
97-
// const engine = new ApolloEngine({
98-
// logging: {
99-
// level: 'WARN',
100-
// },
101-
// apiKey: process.env.APOLLO_ENGINE_API_KEY,
102-
// // Only send perf data to the remote server in production
103-
// reporting: {
104-
// disabled: process.env.NODE_ENV !== 'production',
105-
// hostname: process.env.NOW_URL || undefined,
106-
// privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
107-
// },
108-
// });
109-
110-
// engine.listen({
111-
// port: PORT,
112-
// httpServer: server,
113-
// graphqlPaths: ['/api'],
114-
// });
115-
server.listen(PORT);
97+
const engine = new ApolloEngine({
98+
logging: {
99+
level: 'WARN',
100+
},
101+
apiKey: process.env.APOLLO_ENGINE_API_KEY,
102+
// Only send perf data to the remote server in production
103+
reporting: {
104+
disabled: process.env.NODE_ENV !== 'production',
105+
hostname: process.env.NOW_URL || undefined,
106+
privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
107+
},
108+
queryCache: {
109+
// Don't cache logged-in user responses
110+
privateFullQueryStore: 'disabled',
111+
},
112+
sessionAuth: {
113+
cookie: 'session',
114+
// TODO(@mxstbr): Ping Apollo to note that we need both of those
115+
// header: 'Authorization'
116+
},
117+
});
118+
119+
engine.listen({
120+
port: PORT,
121+
httpServer: server,
122+
graphqlPaths: ['/api'],
123+
});
116124
debug(`GraphQL server running at http://localhost:${PORT}/api`);
117125

118126
process.on('unhandledRejection', async err => {

api/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"aws-sdk": "2.200.0",
99
"axios": "^0.16.2",
1010
"babel-plugin-replace-dynamic-import-runtime": "^1.0.2",
11-
"babel-plugin-styled-components": "^1.5.1",
11+
"babel-plugin-styled-components": "^1.6.1",
1212
"babel-plugin-transform-flow-strip-types": "^6.22.0",
1313
"babel-plugin-transform-object-rest-spread": "^6.23.0",
1414
"babel-preset-env": "^1.7.0",
@@ -85,10 +85,10 @@
8585
"prismjs": "^1.15.0",
8686
"query-string": "5.1.1",
8787
"raven": "^2.6.3",
88-
"raven-js": "^3.26.4",
88+
"raven-js": "^3.27.0",
8989
"react": "^15.4.1",
9090
"react-app-rewire-styled-components": "^3.0.2",
91-
"react-app-rewired": "^1.5.2",
91+
"react-app-rewired": "^1.6.2",
9292
"react-dom": "^15.4.1",
9393
"react-helmet": "5.x",
9494
"react-infinite-scroller-with-scroll-element": "^1.0.4",

api/queries/community/metaData.js

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { DBCommunity } from 'shared/types';
33
import type { GraphQLContext } from '../../';
44
import { canViewCommunity } from '../../utils/permissions';
5+
import cache from 'shared/cache/redis';
56

67
export default async (root: DBCommunity, _: any, ctx: GraphQLContext) => {
78
const { user, loaders } = ctx;
@@ -15,15 +16,49 @@ export default async (root: DBCommunity, _: any, ctx: GraphQLContext) => {
1516
};
1617
}
1718

19+
const [
20+
cachedChannelCount,
21+
cachedMemberCount,
22+
cachedOnlineMemberCount,
23+
] = await Promise.all([
24+
cache.get(`community:${id}:channelCount`),
25+
cache.get(`community:${id}:memberCount`),
26+
cache.get(`community:${id}:onlineMemberCount`),
27+
]);
28+
1829
const [channelCount, memberCount, onlineMemberCount] = await Promise.all([
19-
loaders.communityChannelCount.load(id),
20-
loaders.communityMemberCount.load(id),
21-
loaders.communityOnlineMemberCount.load(id),
30+
typeof cachedChannelCount === 'number' ||
31+
loaders.communityChannelCount
32+
.load(id)
33+
.then(res => (res && res.reduction) || 0),
34+
typeof cachedMemberCount === 'number' ||
35+
loaders.communityMemberCount
36+
.load(id)
37+
.then(res => (res && res.reduction) || 0),
38+
typeof cachedOnlineMemberCount === 'number' ||
39+
loaders.communityOnlineMemberCount
40+
.load(id)
41+
.then(res => (res && res.reduction) || 0),
42+
]);
43+
44+
// Cache the fields for an hour
45+
await Promise.all([
46+
typeof cachedChannelCount === 'number' ||
47+
cache.set(`community:${id}:channelCount`, channelCount, 'ex', 3600),
48+
typeof cachedMemberCount === 'number' ||
49+
cache.set(`community:${id}:memberCount`, memberCount, 'ex', 3600),
50+
typeof cachedOnlineMemberCount === 'number' ||
51+
cache.set(
52+
`community:${id}:onlineMemberCount`,
53+
onlineMemberCount,
54+
'ex',
55+
3600
56+
),
2257
]);
2358

2459
return {
25-
channels: channelCount ? channelCount.reduction : 0,
26-
members: memberCount ? memberCount.reduction : 0,
27-
onlineMembers: onlineMemberCount ? onlineMemberCount.reduction : 0,
60+
channels: channelCount,
61+
members: memberCount,
62+
onlineMembers: onlineMemberCount,
2863
};
2964
};

api/queries/thread/messageConnection.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@ export default (
5353
if (cursor) debug(`cursor: ${cursor}`);
5454

5555
let options = {
56-
// Default first/last to 50 if their counterparts after/before are provided
56+
// Default first/last to 25 if their counterparts after/before are provided
5757
// so users can query messageConnection(after: "cursor") or (before: "cursor")
5858
// without any more options
59-
first: first ? first : after ? 50 : null,
60-
last: last ? last : before ? 50 : null,
59+
first: first ? first : after ? 25 : null,
60+
last: last ? last : before ? 25 : null,
6161
// Set after/before to the cursor depending on which one was requested by the user
6262
after: after ? cursor : null,
6363
before: before ? cursor : null,
6464
};
6565

6666
// If we didn't get any arguments at all (i.e messageConnection {})
67-
// then just fetch the first 50 messages
67+
// then just fetch the first 25 messages
6868
// $FlowIssue
6969
if (Object.keys(options).every(key => !options[key])) {
7070
options = {
71-
first: 50,
71+
first: 25,
7272
};
7373
}
7474

api/routes/api/graphql.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export default graphqlExpress(req => {
1515
return {
1616
schema,
1717
formatError: createErrorFormatter(req),
18+
tracing: true,
19+
cacheControl: true,
20+
engine: false,
1821
context: {
1922
loaders,
2023
user: currentUser,

api/types/Community.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const Community = /* GraphQL */ `
4141
node: Thread!
4242
}
4343
44-
type CommunityMetaData {
44+
type CommunityMetaData @cacheControl(maxAge: 1800) {
4545
members: Int
4646
channels: Int
4747
onlineMembers: Int

api/yarn.lock

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
# yarn lockfile v1
33

44

5-
"@babel/helper-annotate-as-pure@^7.0.0-beta.37":
6-
version "7.0.0-beta.54"
7-
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0-beta.54.tgz#1626126a3f9fc4ed280ac942372c7d39653d7121"
8-
dependencies:
9-
"@babel/types" "7.0.0-beta.54"
10-
115
"@babel/runtime@^7.0.0-beta.38", "@babel/runtime@^7.0.0-beta.40":
126
version "7.0.0-beta.41"
137
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.0.0-beta.41.tgz#776ce13391b8154ccfdea71018a47b63e4d97e74"
@@ -22,14 +16,6 @@
2216
core-js "^2.5.7"
2317
regenerator-runtime "^0.12.0"
2418

25-
26-
version "7.0.0-beta.54"
27-
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.54.tgz#025ad68492fed542c13f14c579a44c848e531063"
28-
dependencies:
29-
esutils "^2.0.2"
30-
lodash "^4.17.5"
31-
to-fast-properties "^2.0.0"
32-
3319
"@octokit/rest@^15.2.6":
3420
version "15.9.4"
3521
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.9.4.tgz#c6cf0f483275d9c798b18419b7c9d417493bb70f"
@@ -859,13 +845,12 @@ babel-plugin-styled-components@^1.1.4:
859845
babel-types "^6.26.0"
860846
stylis "^3.0.0"
861847

862-
babel-plugin-styled-components@^1.5.1:
863-
version "1.5.1"
864-
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.5.1.tgz#31dbeb696d1354d1585e60d66c7905f5e474afcd"
848+
babel-plugin-styled-components@^1.6.1:
849+
version "1.6.1"
850+
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.6.1.tgz#ab8d486813cbef956cfc71e5819a1a2c3282e144"
865851
dependencies:
866-
"@babel/helper-annotate-as-pure" "^7.0.0-beta.37"
867-
babel-types "^6.26.0"
868-
stylis "^3.0.0"
852+
lodash "^4.17.10"
853+
semver "^5.5.1"
869854

870855
babel-plugin-syntax-async-functions@^6.8.0:
871856
version "6.13.0"
@@ -6105,9 +6090,9 @@ range-parser@~1.2.0:
61056090
version "1.2.0"
61066091
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"
61076092

6108-
raven-js@^3.26.4:
6109-
version "3.26.4"
6110-
resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.26.4.tgz#32aae3a63a9314467a453c94c89a364ea43707be"
6093+
raven-js@^3.27.0:
6094+
version "3.27.0"
6095+
resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.27.0.tgz#9f47c03e17933ce756e189f3669d49c441c1ba6e"
61116096

61126097
raven@^2.6.3:
61136098
version "2.6.3"
@@ -6160,9 +6145,9 @@ react-app-rewired@^1.2.0:
61606145
cross-spawn "^5.1.0"
61616146
dotenv "^4.0.0"
61626147

6163-
react-app-rewired@^1.5.2:
6164-
version "1.5.2"
6165-
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-1.5.2.tgz#0f5cdbc92f47f166bb0bcadf8a5d00999b90f68f"
6148+
react-app-rewired@^1.6.2:
6149+
version "1.6.2"
6150+
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-1.6.2.tgz#32ce90abc2c4e2b86c71e4e270bd36663b3b1c9a"
61666151
dependencies:
61676152
cross-spawn "^5.1.0"
61686153
dotenv "^4.0.0"
@@ -6728,6 +6713,10 @@ semver@^5.5.0:
67286713
version "5.5.0"
67296714
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
67306715

6716+
semver@^5.5.1:
6717+
version "5.5.1"
6718+
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477"
6719+
67316720
67326721
version "0.16.2"
67336722
resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1"
@@ -7386,10 +7375,6 @@ to-fast-properties@^1.0.3:
73867375
version "1.0.3"
73877376
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"
73887377

7389-
to-fast-properties@^2.0.0:
7390-
version "2.0.0"
7391-
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
7392-
73937378
to-object-path@^0.3.0:
73947379
version "0.3.0"
73957380
resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af"

athena/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"expo-server-sdk": "^2.4.0",
1414
"node-env-file": "^0.1.8",
1515
"now-env": "^3.1.0",
16-
"raven": "^2.6.3",
16+
"raven": "^2.6.4",
1717
"rethinkdbdash": "^2.3.31",
1818
"source-map-support": "^0.4.18",
1919
"toobusy-js": "^0.5.1",

0 commit comments

Comments
 (0)