kopia lustrzana https://codeberg.org/nmkj/audon
remove shceduling completely
rodzic
e1bbda00c8
commit
d4d1ab6792
|
@ -60,7 +60,6 @@ export default {
|
|||
{ title: this.$t("form.relationships.mutual"), value: "mutual" },
|
||||
{ title: this.$t("form.relationships.private"), value: "private" },
|
||||
],
|
||||
scheduledAt: null,
|
||||
searchResult: null,
|
||||
searchQuery: "",
|
||||
isCandiadateLoading: false,
|
||||
|
@ -193,7 +192,6 @@ export default {
|
|||
const resp = await axios.post("/api/room", payload);
|
||||
if (resp.status === 201) {
|
||||
this.createdRoomID = resp.data;
|
||||
// this.$router.push({ name: "room", params: { id: resp.data } });
|
||||
}
|
||||
} catch (error) {
|
||||
this.searchError.message = `Error: ${error}`;
|
||||
|
|
38
room.go
38
room.go
|
@ -54,39 +54,6 @@ func createRoomHandler(c echo.Context) error {
|
|||
coll := mainDB.Collection(COLLECTION_ROOM)
|
||||
|
||||
now := time.Now().UTC()
|
||||
if now.After(room.ScheduledAt) {
|
||||
// host is trying to create an instant room even though there is another instant room that wasn't used, assumed that host won't use such rooms
|
||||
if cur, err := coll.Find(c.Request().Context(),
|
||||
bson.D{
|
||||
{Key: "host.audon_id", Value: host.AudonID},
|
||||
{Key: "ended_at", Value: time.Time{}}, // host didn't close
|
||||
{Key: "$expr", Value: bson.D{ // instant room
|
||||
{Key: "$eq", Value: bson.A{"$created_at", "$scheduled_at"}},
|
||||
}},
|
||||
}); err == nil {
|
||||
defer cur.Close(c.Request().Context())
|
||||
|
||||
roomIDsToBeDeleted := []string{}
|
||||
for cur.Next(c.Request().Context()) {
|
||||
emptyRoom := new(Room)
|
||||
if err := cur.Decode(emptyRoom); err == nil {
|
||||
if !emptyRoom.IsAnyomeInLivekitRoom(c.Request().Context()) {
|
||||
roomIDsToBeDeleted = append(roomIDsToBeDeleted, emptyRoom.RoomID)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(roomIDsToBeDeleted) > 0 {
|
||||
coll.DeleteMany(c.Request().Context(), bson.D{{
|
||||
Key: "room_id",
|
||||
Value: bson.D{{Key: "$in", Value: roomIDsToBeDeleted}}},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
room.ScheduledAt = now
|
||||
} else {
|
||||
// TODO: limit the number of rooms one can schedule?
|
||||
}
|
||||
|
||||
// TODO: use a job scheduler to manage rooms?
|
||||
|
||||
|
@ -285,11 +252,6 @@ func joinRoomHandler(c echo.Context) (err error) {
|
|||
|
||||
now := time.Now().UTC()
|
||||
|
||||
// check if room is not yet started
|
||||
if room.ScheduledAt.After(now) {
|
||||
return echo.NewHTTPError(http.StatusConflict, "not_yet_started")
|
||||
}
|
||||
|
||||
// check if room has already ended
|
||||
if !room.EndedAt.IsZero() && room.EndedAt.Before(now) {
|
||||
return ErrAlreadyEnded
|
||||
|
|
|
@ -42,7 +42,6 @@ type (
|
|||
CoHosts []*AudonUser `bson:"cohosts" json:"cohosts"`
|
||||
Restriction JoinRestriction `bson:"restriction" json:"restriction"`
|
||||
Kicked []*AudonUser `bson:"kicked" json:"kicked"`
|
||||
ScheduledAt time.Time `bson:"scheduled_at" json:"scheduled_at"`
|
||||
EndedAt time.Time `bson:"ended_at" json:"ended_at"`
|
||||
CreatedAt time.Time `bson:"created_at" json:"created_at"`
|
||||
Advertise string `bson:"advertise" json:"advertise"`
|
||||
|
|
Ładowanie…
Reference in New Issue