Merge pull request #3484 from matrix-org/dbkr/rageshake_go_backwards
Truncate debug logs at the start, not the endpull/21833/head
						commit
						509833e213
					
				|  | @ -258,7 +258,7 @@ class IndexedDBLogStore { | |||
|             const objectStore = db.transaction("logs", "readonly").objectStore("logs"); | ||||
| 
 | ||||
|             return new Promise((resolve, reject) => { | ||||
|                 const query = objectStore.index("id").openCursor(IDBKeyRange.only(id), 'next'); | ||||
|                 const query = objectStore.index("id").openCursor(IDBKeyRange.only(id), 'prev'); | ||||
|                 let lines = ''; | ||||
|                 query.onerror = (event) => { | ||||
|                     reject(new Error("Query failed: " + event.target.errorCode)); | ||||
|  | @ -269,10 +269,10 @@ class IndexedDBLogStore { | |||
|                         resolve(lines); | ||||
|                         return; // end of results
 | ||||
|                     } | ||||
|                     lines += cursor.value.lines; | ||||
|                     if (lines.length >= MAX_LOG_SIZE) { | ||||
|                     if (lines.length + cursor.value.lines.length >= MAX_LOG_SIZE && lines.length > 0) { | ||||
|                         resolve(lines); | ||||
|                     } else { | ||||
|                         lines = cursor.value.lines + lines; | ||||
|                         cursor.continue(); | ||||
|                     } | ||||
|                 }; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 David Baker
						David Baker