enhance: pizzaxでstreamingのuser storage updateイベントを監視して更新 (#8095)

* wip

* wip?

* ?

* streamingのuser storage updateイベントを監視して更新

* 必要な時以外はストレージを更新しない

* fix?

* wip

* fix

* fix
This commit is contained in:
tamaina
2021-12-29 22:13:09 +09:00
committed by GitHub
parent 99eb919f4e
commit e159f15600
31 changed files with 98 additions and 53 deletions

View File

@ -101,6 +101,7 @@ const alpha = (hex, a) => {
return `rgba(${r}, ${g}, ${b}, ${a})`;
};
import * as os from '@/os';
import { stream } from '@/stream';
export default defineComponent({
components: {
@ -119,7 +120,7 @@ export default defineComponent({
stats: null,
serverInfo: null,
connection: null,
queueConnection: markRaw(os.stream.useChannel('queueStats')),
queueConnection: markRaw(stream.useChannel('queueStats')),
memUsage: 0,
chartCpuMem: null,
chartNet: null,
@ -150,7 +151,7 @@ export default defineComponent({
os.api('admin/server-info', {}).then(res => {
this.serverInfo = res;
this.connection = markRaw(os.stream.useChannel('serverStats'));
this.connection = markRaw(stream.useChannel('serverStats'));
this.connection.on('stats', this.onStats);
this.connection.on('statsLog', this.onStatsLog);
this.connection.send('requestLog', {

View File

@ -81,6 +81,7 @@ import number from '@/filters/number';
import MkInstanceInfo from './instance.vue';
import XMetrics from './metrics.vue';
import * as os from '@/os';
import { stream } from '@/stream';
import * as symbols from '@/symbols';
export default defineComponent({
@ -113,7 +114,7 @@ export default defineComponent({
notesComparedToThePrevDay: null,
fetchJobs: () => os.api('admin/queue/deliver-delayed', {}),
fetchModLogs: () => os.api('admin/show-moderation-logs', {}),
queueStatsConnection: markRaw(os.stream.useChannel('queueStats')),
queueStatsConnection: markRaw(stream.useChannel('queueStats')),
}
},

View File

@ -17,6 +17,7 @@ import XQueue from './queue.chart.vue';
import FormBase from '@/components/debobigego/base.vue';
import FormButton from '@/components/debobigego/button.vue';
import * as os from '@/os';
import { stream } from '@/stream';
import * as symbols from '@/symbols';
export default defineComponent({
@ -36,7 +37,7 @@ export default defineComponent({
icon: 'fas fa-clipboard-list',
bg: 'var(--bg)',
},
connection: markRaw(os.stream.useChannel('queueStats')),
connection: markRaw(stream.useChannel('queueStats')),
}
},

View File

@ -44,6 +44,7 @@ import * as Acct from 'misskey-js/built/acct';
import MkButton from '@/components/ui/button.vue';
import { acct } from '@/filters/user';
import * as os from '@/os';
import { stream } from '@/stream';
import * as symbols from '@/symbols';
export default defineComponent({
@ -66,7 +67,7 @@ export default defineComponent({
},
mounted() {
this.connection = markRaw(os.stream.useChannel('messagingIndex'));
this.connection = markRaw(stream.useChannel('messagingIndex'));
this.connection.on('message', this.onMessage);
this.connection.on('read', this.onRead);

View File

@ -28,6 +28,7 @@ import * as autosize from 'autosize';
import { formatTimeString } from '@/scripts/format-time-string';
import { selectFile } from '@/scripts/select-file';
import * as os from '@/os';
import { stream } from '@/stream';
import { Autocomplete } from '@/scripts/autocomplete';
import { throttle } from 'throttle-debounce';
@ -48,7 +49,7 @@ export default defineComponent({
file: null,
sending: false,
typing: throttle(3000, () => {
os.stream.send('typingOnMessaging', this.user ? { partner: this.user.id } : { group: this.group.id });
stream.send('typingOnMessaging', this.user ? { partner: this.user.id } : { group: this.group.id });
}),
};
},

View File

@ -43,6 +43,7 @@ import XForm from './messaging-room.form.vue';
import * as Acct from 'misskey-js/built/acct';
import { isBottom, onScrollBottom, scroll } from '@/scripts/scroll';
import * as os from '@/os';
import { stream } from '@/stream';
import { popout } from '@/scripts/popout';
import * as sound from '@/scripts/sound';
import * as symbols from '@/symbols';
@ -141,7 +142,7 @@ const Component = defineComponent({
this.group = group;
}
this.connection = markRaw(os.stream.useChannel('messaging', {
this.connection = markRaw(stream.useChannel('messaging', {
otherparty: this.user ? this.user.id : undefined,
group: this.group ? this.group.id : undefined,
}));

View File

@ -9,6 +9,7 @@ import { defineComponent, markRaw } from 'vue';
import GameSetting from './game.setting.vue';
import GameBoard from './game.board.vue';
import * as os from '@/os';
import { stream } from '@/stream';
import * as symbols from '@/symbols';
export default defineComponent({
@ -61,7 +62,7 @@ export default defineComponent({
if (this.connection) {
this.connection.dispose();
}
this.connection = markRaw(os.stream.useChannel('gamesReversiGame', {
this.connection = markRaw(stream.useChannel('gamesReversiGame', {
gameId: this.game.id
}));
this.connection.on('started', this.onStarted);

View File

@ -62,6 +62,7 @@
<script lang="ts">
import { defineComponent, markRaw } from 'vue';
import * as os from '@/os';
import { stream } from '@/stream';
import MkButton from '@/components/ui/button.vue';
import MkFolder from '@/components/ui/folder.vue';
import * as symbols from '@/symbols';
@ -92,7 +93,7 @@ export default defineComponent({
mounted() {
if (this.$i) {
this.connection = markRaw(os.stream.useChannel('gamesReversi'));
this.connection = markRaw(stream.useChannel('gamesReversi'));
this.connection.on('invited', this.onInvited);