mirror of
git://jb55.com/damus
synced 2024-09-18 19:23:49 +00:00
debug: remove note size debug
ThreadSanitizer was complaining about a data race
This commit is contained in:
parent
624a7b4e88
commit
a73271e3d4
@ -53,12 +53,14 @@ class NdbNote: Encodable, Equatable, Hashable {
|
|||||||
self.owned = owned_size != nil
|
self.owned = owned_size != nil
|
||||||
self.count = owned_size ?? 0
|
self.count = owned_size ?? 0
|
||||||
|
|
||||||
|
#if DEBUG_NOTE_SIZE
|
||||||
if let owned_size {
|
if let owned_size {
|
||||||
NdbNote.total_ndb_size += Int(owned_size)
|
NdbNote.total_ndb_size += Int(owned_size)
|
||||||
NdbNote.notes_created += 1
|
NdbNote.notes_created += 1
|
||||||
|
|
||||||
print("\(NdbNote.notes_created) ndb_notes, \(NdbNote.total_ndb_size) bytes")
|
print("\(NdbNote.notes_created) ndb_notes, \(NdbNote.total_ndb_size) bytes")
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,10 +104,12 @@ class NdbNote: Encodable, Equatable, Hashable {
|
|||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
if self.owned {
|
if self.owned {
|
||||||
|
#if DEBUG_NOTE_SIZE
|
||||||
NdbNote.total_ndb_size -= Int(count)
|
NdbNote.total_ndb_size -= Int(count)
|
||||||
NdbNote.notes_created -= 1
|
NdbNote.notes_created -= 1
|
||||||
|
|
||||||
print("\(NdbNote.notes_created) ndb_notes, \(NdbNote.total_ndb_size) bytes")
|
print("\(NdbNote.notes_created) ndb_notes, \(NdbNote.total_ndb_size) bytes")
|
||||||
|
#endif
|
||||||
free(note)
|
free(note)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,8 +139,10 @@ class NdbNote: Encodable, Equatable, Hashable {
|
|||||||
try container.encode(tags, forKey: .tags)
|
try container.encode(tags, forKey: .tags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG_NOTE_SIZE
|
||||||
static var total_ndb_size: Int = 0
|
static var total_ndb_size: Int = 0
|
||||||
static var notes_created: Int = 0
|
static var notes_created: Int = 0
|
||||||
|
#endif
|
||||||
|
|
||||||
init?(content: String, keypair: Keypair, kind: UInt32 = 1, tags: [[String]] = [], createdAt: UInt32 = UInt32(Date().timeIntervalSince1970)) {
|
init?(content: String, keypair: Keypair, kind: UInt32 = 1, tags: [[String]] = [], createdAt: UInt32 = UInt32(Date().timeIntervalSince1970)) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user