Skip to content
This repository was archived by the owner on Jun 16, 2024. It is now read-only.

Commit e131792

Browse files
committed
CHAT_CACHE_KEY
1 parent fbfacdd commit e131792

File tree

6 files changed

+8
-2
lines changed

6 files changed

+8
-2
lines changed

app/javascript/Api.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { mutate } from "swr";
33
import * as Rails from "@rails/ujs";
44
import dayjs from "dayjs";
55

6+
import { CHAT_CACHE_KEY } from "./meta";
7+
68
import { useState, useEffect } from "react";
79

810
export class ApiError extends Error {
@@ -509,7 +511,7 @@ export const Api = {
509511
useChatSession(attendeeId: number | undefined) {
510512
// attendeeId for cache buster
511513
return useSWR<GetChatSessionResponse, ApiError>(
512-
attendeeId ? `/api/chat_session?i=${attendeeId}` : null,
514+
attendeeId ? `/api/chat_session?i=${attendeeId}&p=${CHAT_CACHE_KEY}` : null,
513515
swrFetcher,
514516
{
515517
revalidateOnFocus: true,

app/javascript/meta.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export const DEFAULT_AVATAR_URL = document.querySelector<HTMLMetaElement>('meta[name="rkto:default-avatar"]')?.content;
22
export const SENTRY_DSN = document.querySelector<HTMLMetaElement>('meta[name="rkto:sentry-dsn"]')?.content;
3+
export const CHAT_CACHE_KEY = document.querySelector<HTMLMetaElement>('meta[name="rkto:chat-cache-key"]')?.content;

app/views/layouts/application.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
<meta name="rkto:commit" content="<%= Rails.application.config.x.release_meta.commit %>">
1616
<meta name="rkto:release" content="<%= Rails.application.config.x.release_meta.version %>">
17+
<meta name="rkto:chat-cache-key" content="<%= Rails.application.config.x.release_meta.chat_cache_key %>">
1718

1819
<%= stylesheet_pack_tag 'vendor', media: 'all' %>
1920
<%= stylesheet_pack_tag 'application', media: 'all' %>

config/environments/development.rb

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
config.x.sentry.dsn = ENV['SENTRY_DSN']
1515
config.x.release_meta.commit = ''
1616
config.x.release_meta.version = ''
17+
config.x.release_meta.chat_cache_key = ENV['TAKEOUT_CHAT_CACHE_KEY']
1718

1819
config.x.control.password = ENV['TAKEOUT_CONTROL_PASSWORD']
1920

config/environments/production.rb

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
config.x.sentry.dsn = ENV['SENTRY_DSN']
2222
config.x.release_meta.commit = ENV['HEROKU_SLUG_COMMIT']
2323
config.x.release_meta.version = ENV['HEROKU_RELEASE_VERSION']
24+
config.x.release_meta.chat_cache_key = ENV['TAKEOUT_CHAT_CACHE_KEY']
2425
end
2526

2627
config.active_job.queue_adapter = ENV.fetch('ENABLE_SHORYUKEN', '1') == '1' ? :shoryuken : :inline

config/puma.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# Workers do not work on JRuby or Windows (both of which do not support
3232
# processes).
3333
#
34-
workers ENV.fetch("WEB_CONCURRENCY") { 2 }
34+
workers ENV.fetch("WEB_CONCURRENCY") { 0 }
3535

3636
# Use the `preload_app!` method when specifying a `workers` number.
3737
# This directive tells Puma to first boot the application and load code

0 commit comments

Comments
 (0)