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

Commit

Permalink
Merge pull request #3898 from withspectrum/2.4.34
Browse files Browse the repository at this point in the history
2.4.34
  • Loading branch information
brianlovin authored Sep 5, 2018
2 parents d592692 + 30980e2 commit 51fde98
Show file tree
Hide file tree
Showing 28 changed files with 189 additions and 271 deletions.
2 changes: 1 addition & 1 deletion analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"bull": "3.3.10",
"node-env-file": "^0.1.8",
"now-env": "^3.1.0",
"raven": "^2.6.3",
"raven": "^2.6.4",
"rethinkdbdash": "^2.3.29",
"sha1": "^1.1.1",
"source-map-support": "^0.5.9",
Expand Down
14 changes: 7 additions & 7 deletions analytics/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,15 @@ qs@^6.5.1:
version "6.5.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"

raven@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/raven/-/raven-2.6.3.tgz#207475a12809277ef54eaceafe2597ff65262ab4"
raven@^2.6.4:
version "2.6.4"
resolved "https://registry.yarnpkg.com/raven/-/raven-2.6.4.tgz#458d4a380c8fbb59e0150c655625aaf60c167ea3"
dependencies:
cookie "0.3.1"
md5 "^2.2.1"
stack-trace "0.0.10"
timed-out "4.0.1"
uuid "3.0.0"
uuid "3.3.2"

readable-stream@^2.3.5:
version "2.3.6"
Expand Down Expand Up @@ -401,9 +401,9 @@ util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"

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

uuid@^3.1.0:
version "3.2.1"
Expand Down
46 changes: 27 additions & 19 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,33 @@ import createSubscriptionsServer from './routes/create-subscription-server';
const subscriptionsServer = createSubscriptionsServer(server, '/websocket');

// Start API wrapped in Apollo Engine
// const engine = new ApolloEngine({
// logging: {
// level: 'WARN',
// },
// apiKey: process.env.APOLLO_ENGINE_API_KEY,
// // Only send perf data to the remote server in production
// reporting: {
// disabled: process.env.NODE_ENV !== 'production',
// hostname: process.env.NOW_URL || undefined,
// privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
// },
// });

// engine.listen({
// port: PORT,
// httpServer: server,
// graphqlPaths: ['/api'],
// });
server.listen(PORT);
const engine = new ApolloEngine({
logging: {
level: 'WARN',
},
apiKey: process.env.APOLLO_ENGINE_API_KEY,
// Only send perf data to the remote server in production
reporting: {
disabled: process.env.NODE_ENV !== 'production',
hostname: process.env.NOW_URL || undefined,
privateHeaders: ['authorization', 'Authorization', 'AUTHORIZATION'],
},
queryCache: {
// Don't cache logged-in user responses
privateFullQueryStore: 'disabled',
},
sessionAuth: {
cookie: 'session',
// TODO(@mxstbr): Ping Apollo to note that we need both of those
// header: 'Authorization'
},
});

engine.listen({
port: PORT,
httpServer: server,
graphqlPaths: ['/api'],
});
debug(`GraphQL server running at http://localhost:${PORT}/api`);

process.on('unhandledRejection', async err => {
Expand Down
6 changes: 3 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"aws-sdk": "2.200.0",
"axios": "^0.16.2",
"babel-plugin-replace-dynamic-import-runtime": "^1.0.2",
"babel-plugin-styled-components": "^1.5.1",
"babel-plugin-styled-components": "^1.6.1",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-preset-env": "^1.7.0",
Expand Down Expand Up @@ -85,10 +85,10 @@
"prismjs": "^1.15.0",
"query-string": "5.1.1",
"raven": "^2.6.3",
"raven-js": "^3.26.4",
"raven-js": "^3.27.0",
"react": "^15.4.1",
"react-app-rewire-styled-components": "^3.0.2",
"react-app-rewired": "^1.5.2",
"react-app-rewired": "^1.6.2",
"react-dom": "^15.4.1",
"react-helmet": "5.x",
"react-infinite-scroller-with-scroll-element": "^1.0.4",
Expand Down
47 changes: 41 additions & 6 deletions api/queries/community/metaData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type { DBCommunity } from 'shared/types';
import type { GraphQLContext } from '../../';
import { canViewCommunity } from '../../utils/permissions';
import cache from 'shared/cache/redis';

export default async (root: DBCommunity, _: any, ctx: GraphQLContext) => {
const { user, loaders } = ctx;
Expand All @@ -15,15 +16,49 @@ export default async (root: DBCommunity, _: any, ctx: GraphQLContext) => {
};
}

const [
cachedChannelCount,
cachedMemberCount,
cachedOnlineMemberCount,
] = await Promise.all([
cache.get(`community:${id}:channelCount`),
cache.get(`community:${id}:memberCount`),
cache.get(`community:${id}:onlineMemberCount`),
]);

const [channelCount, memberCount, onlineMemberCount] = await Promise.all([
loaders.communityChannelCount.load(id),
loaders.communityMemberCount.load(id),
loaders.communityOnlineMemberCount.load(id),
typeof cachedChannelCount === 'number' ||
loaders.communityChannelCount
.load(id)
.then(res => (res && res.reduction) || 0),
typeof cachedMemberCount === 'number' ||
loaders.communityMemberCount
.load(id)
.then(res => (res && res.reduction) || 0),
typeof cachedOnlineMemberCount === 'number' ||
loaders.communityOnlineMemberCount
.load(id)
.then(res => (res && res.reduction) || 0),
]);

// Cache the fields for an hour
await Promise.all([
typeof cachedChannelCount === 'number' ||
cache.set(`community:${id}:channelCount`, channelCount, 'ex', 3600),
typeof cachedMemberCount === 'number' ||
cache.set(`community:${id}:memberCount`, memberCount, 'ex', 3600),
typeof cachedOnlineMemberCount === 'number' ||
cache.set(
`community:${id}:onlineMemberCount`,
onlineMemberCount,
'ex',
3600
),
]);

return {
channels: channelCount ? channelCount.reduction : 0,
members: memberCount ? memberCount.reduction : 0,
onlineMembers: onlineMemberCount ? onlineMemberCount.reduction : 0,
channels: channelCount,
members: memberCount,
onlineMembers: onlineMemberCount,
};
};
10 changes: 5 additions & 5 deletions api/queries/thread/messageConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,22 @@ export default (
if (cursor) debug(`cursor: ${cursor}`);

let options = {
// Default first/last to 50 if their counterparts after/before are provided
// Default first/last to 25 if their counterparts after/before are provided
// so users can query messageConnection(after: "cursor") or (before: "cursor")
// without any more options
first: first ? first : after ? 50 : null,
last: last ? last : before ? 50 : null,
first: first ? first : after ? 25 : null,
last: last ? last : before ? 25 : null,
// Set after/before to the cursor depending on which one was requested by the user
after: after ? cursor : null,
before: before ? cursor : null,
};

// If we didn't get any arguments at all (i.e messageConnection {})
// then just fetch the first 50 messages
// then just fetch the first 25 messages
// $FlowIssue
if (Object.keys(options).every(key => !options[key])) {
options = {
first: 50,
first: 25,
};
}

Expand Down
3 changes: 3 additions & 0 deletions api/routes/api/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export default graphqlExpress(req => {
return {
schema,
formatError: createErrorFormatter(req),
tracing: true,
cacheControl: true,
engine: false,
context: {
loaders,
user: currentUser,
Expand Down
2 changes: 1 addition & 1 deletion api/types/Community.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Community = /* GraphQL */ `
node: Thread!
}
type CommunityMetaData {
type CommunityMetaData @cacheControl(maxAge: 1800) {
members: Int
channels: Int
onlineMembers: Int
Expand Down
45 changes: 15 additions & 30 deletions api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
# yarn lockfile v1


"@babel/helper-annotate-as-pure@^7.0.0-beta.37":
version "7.0.0-beta.54"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0-beta.54.tgz#1626126a3f9fc4ed280ac942372c7d39653d7121"
dependencies:
"@babel/types" "7.0.0-beta.54"

"@babel/runtime@^7.0.0-beta.38", "@babel/runtime@^7.0.0-beta.40":
version "7.0.0-beta.41"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.0.0-beta.41.tgz#776ce13391b8154ccfdea71018a47b63e4d97e74"
Expand All @@ -22,14 +16,6 @@
core-js "^2.5.7"
regenerator-runtime "^0.12.0"

"@babel/types@7.0.0-beta.54":
version "7.0.0-beta.54"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.54.tgz#025ad68492fed542c13f14c579a44c848e531063"
dependencies:
esutils "^2.0.2"
lodash "^4.17.5"
to-fast-properties "^2.0.0"

"@octokit/rest@^15.2.6":
version "15.9.4"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.9.4.tgz#c6cf0f483275d9c798b18419b7c9d417493bb70f"
Expand Down Expand Up @@ -859,13 +845,12 @@ babel-plugin-styled-components@^1.1.4:
babel-types "^6.26.0"
stylis "^3.0.0"

babel-plugin-styled-components@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.5.1.tgz#31dbeb696d1354d1585e60d66c7905f5e474afcd"
babel-plugin-styled-components@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.6.1.tgz#ab8d486813cbef956cfc71e5819a1a2c3282e144"
dependencies:
"@babel/helper-annotate-as-pure" "^7.0.0-beta.37"
babel-types "^6.26.0"
stylis "^3.0.0"
lodash "^4.17.10"
semver "^5.5.1"

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

raven-js@^3.26.4:
version "3.26.4"
resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.26.4.tgz#32aae3a63a9314467a453c94c89a364ea43707be"
raven-js@^3.27.0:
version "3.27.0"
resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.27.0.tgz#9f47c03e17933ce756e189f3669d49c441c1ba6e"

raven@^2.6.3:
version "2.6.3"
Expand Down Expand Up @@ -6160,9 +6145,9 @@ react-app-rewired@^1.2.0:
cross-spawn "^5.1.0"
dotenv "^4.0.0"

react-app-rewired@^1.5.2:
version "1.5.2"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-1.5.2.tgz#0f5cdbc92f47f166bb0bcadf8a5d00999b90f68f"
react-app-rewired@^1.6.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-1.6.2.tgz#32ce90abc2c4e2b86c71e4e270bd36663b3b1c9a"
dependencies:
cross-spawn "^5.1.0"
dotenv "^4.0.0"
Expand Down Expand Up @@ -6728,6 +6713,10 @@ semver@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"

semver@^5.5.1:
version "5.5.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477"

send@0.16.2:
version "0.16.2"
resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1"
Expand Down Expand Up @@ -7386,10 +7375,6 @@ to-fast-properties@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"

to-fast-properties@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"

to-object-path@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af"
Expand Down
2 changes: 1 addition & 1 deletion athena/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"expo-server-sdk": "^2.4.0",
"node-env-file": "^0.1.8",
"now-env": "^3.1.0",
"raven": "^2.6.3",
"raven": "^2.6.4",
"rethinkdbdash": "^2.3.31",
"source-map-support": "^0.4.18",
"toobusy-js": "^0.5.1",
Expand Down
14 changes: 7 additions & 7 deletions athena/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,15 @@ promise@^7.1.1:
dependencies:
asap "~2.0.3"

raven@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/raven/-/raven-2.6.3.tgz#207475a12809277ef54eaceafe2597ff65262ab4"
raven@^2.6.4:
version "2.6.4"
resolved "https://registry.yarnpkg.com/raven/-/raven-2.6.4.tgz#458d4a380c8fbb59e0150c655625aaf60c167ea3"
dependencies:
cookie "0.3.1"
md5 "^2.2.1"
stack-trace "0.0.10"
timed-out "4.0.1"
uuid "3.0.0"
uuid "3.3.2"

redis-commands@^1.2.0:
version "1.3.1"
Expand Down Expand Up @@ -510,9 +510,9 @@ urlsafe-base64@^1.0.0, urlsafe-base64@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/urlsafe-base64/-/urlsafe-base64-1.0.0.tgz#23f89069a6c62f46cf3a1d3b00169cefb90be0c6"

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

uuid@^3.1.0:
version "3.1.0"
Expand Down
2 changes: 1 addition & 1 deletion chronos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lodash.intersection": "^4.4.0",
"now-env": "^3.1.0",
"postmark": "^1.3.1",
"raven": "^2.6.3",
"raven": "^2.6.4",
"rethinkdbdash": "^2.3.29",
"source-map-support": "^0.4.18",
"toobusy-js": "^0.5.1"
Expand Down
Loading

0 comments on commit 51fde98

Please sign in to comment.