Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
3b78e43a
Unverified
Commit
3b78e43a
authored
3 years ago
by
Timo Kösters
Browse files
Options
Downloads
Patches
Plain Diff
fmt
parent
4956fb9f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/database.rs
+44
-32
44 additions, 32 deletions
src/database.rs
src/server_server.rs
+1
-1
1 addition, 1 deletion
src/server_server.rs
with
45 additions
and
33 deletions
src/database.rs
+
44
−
32
View file @
3b78e43a
...
@@ -636,48 +636,60 @@ pub async fn load_or_create(config: &Config) -> Result<Arc<TokioRwLock<Self>>> {
...
@@ -636,48 +636,60 @@ pub async fn load_or_create(config: &Config) -> Result<Arc<TokioRwLock<Self>>> {
if
db
.globals
.database_version
()
?
<
9
{
if
db
.globals
.database_version
()
?
<
9
{
// Update tokenids db layout
// Update tokenids db layout
let
batch
=
db
.rooms.tokenids
.iter
()
.filter_map
(|(
key
,
_
)|
{
let
batch
=
db
if
!
key
.starts_with
(
b"!"
)
{
.rooms
return
None
;
.tokenids
}
.iter
()
let
mut
parts
=
key
.splitn
(
4
,
|
&
b
|
b
==
0xff
);
.filter_map
(|(
key
,
_
)|
{
let
room_id
=
parts
.next
()
.unwrap
();
if
!
key
.starts_with
(
b"!"
)
{
let
word
=
parts
.next
()
.unwrap
();
return
None
;
let
_pdu_id_room
=
parts
.next
()
.unwrap
();
}
let
pdu_id_count
=
parts
.next
()
.unwrap
();
let
mut
parts
=
key
.splitn
(
4
,
|
&
b
|
b
==
0xff
);
let
room_id
=
parts
.next
()
.unwrap
();
let
word
=
parts
.next
()
.unwrap
();
let
_pdu_id_room
=
parts
.next
()
.unwrap
();
let
pdu_id_count
=
parts
.next
()
.unwrap
();
let
short_room_id
=
db
let
short_room_id
=
db
.rooms
.rooms
.roomid_shortroomid
.roomid_shortroomid
.get
(
&
room_id
)
.get
(
&
room_id
)
.unwrap
()
.unwrap
()
.expect
(
"shortroomid should exist"
);
.expect
(
"shortroomid should exist"
);
let
mut
new_key
=
short_room_id
;
let
mut
new_key
=
short_room_id
;
new_key
.extend_from_slice
(
word
);
new_key
.extend_from_slice
(
word
);
new_key
.push
(
0xff
);
new_key
.push
(
0xff
);
new_key
.extend_from_slice
(
pdu_id_count
);
new_key
.extend_from_slice
(
pdu_id_count
);
println!
(
"old {:?}"
,
key
);
println!
(
"old {:?}"
,
key
);
println!
(
"new {:?}"
,
new_key
);
println!
(
"new {:?}"
,
new_key
);
Some
((
new_key
,
Vec
::
new
()))
Some
((
new_key
,
Vec
::
new
()))
})
.collect
::
<
Vec
<
_
>>
();
})
.collect
::
<
Vec
<
_
>>
();
let
mut
iter
=
batch
.into_iter
()
.peekable
();
let
mut
iter
=
batch
.into_iter
()
.peekable
();
while
iter
.peek
()
.is_some
()
{
while
iter
.peek
()
.is_some
()
{
db
.rooms.tokenids
.insert_batch
(
&
mut
iter
.by_ref
()
.take
(
1000
))
?
;
db
.rooms
.tokenids
.insert_batch
(
&
mut
iter
.by_ref
()
.take
(
1000
))
?
;
println!
(
"smaller batch done"
);
println!
(
"smaller batch done"
);
}
}
println!
(
"Deleting starts"
);
println!
(
"Deleting starts"
);
let
batch2
=
db
.rooms.tokenids
.iter
()
.filter_map
(|(
key
,
_
)|
{
let
batch2
=
db
if
key
.starts_with
(
b"!"
)
{
.rooms
println!
(
"del {:?}"
,
key
);
.tokenids
Some
(
key
)
.iter
()
}
else
{
.filter_map
(|(
key
,
_
)|
{
None
if
key
.starts_with
(
b"!"
)
{
}
println!
(
"del {:?}"
,
key
);
})
.collect
::
<
Vec
<
_
>>
();
Some
(
key
)
}
else
{
None
}
})
.collect
::
<
Vec
<
_
>>
();
for
key
in
batch2
{
for
key
in
batch2
{
println!
(
"del"
);
println!
(
"del"
);
...
...
This diff is collapsed.
Click to expand it.
src/server_server.rs
+
1
−
1
View file @
3b78e43a
...
@@ -912,7 +912,7 @@ pub async fn handle_incoming_pdu<'a>(
...
@@ -912,7 +912,7 @@ pub async fn handle_incoming_pdu<'a>(
// Max limit reached
// Max limit reached
warn!
(
"Max prev event limit reached!"
);
warn!
(
"Max prev event limit reached!"
);
graph
.insert
(
prev_event_id
.clone
(),
HashSet
::
new
());
graph
.insert
(
prev_event_id
.clone
(),
HashSet
::
new
());
continue
continue
;
}
}
if
let
Some
(
json
)
=
if
let
Some
(
json
)
=
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment