forked from ppfun/pixelplanet
debug
This commit is contained in:
parent
3b26d3486c
commit
d6eb9510fd
|
@ -55,6 +55,7 @@ persistStore(store, {}, () => {
|
||||||
|
|
||||||
// for debugging
|
// for debugging
|
||||||
window.ppStore = store;
|
window.ppStore = store;
|
||||||
|
window.ppRender = getRenderer;
|
||||||
});
|
});
|
||||||
|
|
||||||
(function load() {
|
(function load() {
|
||||||
|
|
|
@ -99,5 +99,5 @@ export const APISOCKET_USER_NAME = 'apisocket';
|
||||||
|
|
||||||
// maximum chunks to subscribe to
|
// maximum chunks to subscribe to
|
||||||
export const MAX_LOADED_CHUNKS = 2000;
|
export const MAX_LOADED_CHUNKS = 2000;
|
||||||
export const MAX_CHUNK_AGE = 300000;
|
export const MAX_CHUNK_AGE = 20000;
|
||||||
export const GC_INTERVAL = 300000;
|
export const GC_INTERVAL = 20000;
|
||||||
|
|
|
@ -637,6 +637,7 @@ class SocketServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteChunk(chunkid, ws) {
|
deleteChunk(chunkid, ws) {
|
||||||
|
console.log('delete chunk', (chunkid >> 8) & 0x00FF, chunkid & 0x00FF, 'for', ws.user.ip);
|
||||||
ws.chunkCnt -= 1;
|
ws.chunkCnt -= 1;
|
||||||
if (!this.CHUNK_CLIENTS.has(chunkid)) return;
|
if (!this.CHUNK_CLIENTS.has(chunkid)) return;
|
||||||
const clients = this.CHUNK_CLIENTS.get(chunkid);
|
const clients = this.CHUNK_CLIENTS.get(chunkid);
|
||||||
|
@ -646,6 +647,7 @@ class SocketServer {
|
||||||
|
|
||||||
deleteAllChunks(ws) {
|
deleteAllChunks(ws) {
|
||||||
if (!ws.chunkCnt) return;
|
if (!ws.chunkCnt) return;
|
||||||
|
console.logger('delete all chunks for', ws.user.ip);
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
for (const client of this.CHUNK_CLIENTS.values()) {
|
for (const client of this.CHUNK_CLIENTS.values()) {
|
||||||
const pos = client.indexOf(ws);
|
const pos = client.indexOf(ws);
|
||||||
|
|
|
@ -219,6 +219,7 @@ export function requestBigChunk(center) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeChunks(chunks) {
|
export function removeChunks(chunks) {
|
||||||
|
console.log('remove chunks');
|
||||||
return {
|
return {
|
||||||
type: 'REMOVE_CHUNKS',
|
type: 'REMOVE_CHUNKS',
|
||||||
chunks,
|
chunks,
|
||||||
|
|
|
@ -17,7 +17,9 @@ export default (store) => (next) => (action) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'REMOVE_CHUNKS': {
|
case 'REMOVE_CHUNKS': {
|
||||||
|
console.log('do');
|
||||||
const { chunks } = action;
|
const { chunks } = action;
|
||||||
|
console.log('deregister', chunks.filter((chunk) => chunk.recUpdates).map((chunk) => [chunk.i, chunk.j]));
|
||||||
const ids = chunks
|
const ids = chunks
|
||||||
.filter((chunk) => chunk.recUpdates)
|
.filter((chunk) => chunk.recUpdates)
|
||||||
.map((chunk) => chunk.id);
|
.map((chunk) => chunk.id);
|
||||||
|
|
|
@ -122,7 +122,9 @@ class ChunkLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.bcRemoveChunks(remChunks);
|
if (remChunks.length) {
|
||||||
|
this.bcRemoveChunks(remChunks);
|
||||||
|
}
|
||||||
// eslint-disable-next-line no-console,max-len
|
// eslint-disable-next-line no-console,max-len
|
||||||
console.log(`GC cleaned ${remChunks.length} / ${chunks.size + remChunks.length} chunks`);
|
console.log(`GC cleaned ${remChunks.length} / ${chunks.size + remChunks.length} chunks`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user