태그

2022년 7월 31일 일요일

Lightsail browser-based SSH log in fail


 AWS Lightsail Ubuntu 20.04


apt upgrade 이후


browser-based SSH 연결을 사용할 수 없다.


Log in failed. If this instance has just started up, try again in a minute or two.

CLIENT_UNAUTHORIZED [769]





이거슨...

apt upgrade 할 때,

ssh 설정이 바뀌면서 발생한 문제다.

(아래와 같은 창이 뜨길래 첫 번째 옵션을 선택했었다)




재설정이 번거롭다면, 두 번째를 선택해서 현재 설정을 유지하도록 하자.


끝.




2022년 7월 7일 목요일

Django update_or_create 사용 시 주의 - 데이터 중복발생 가능성

 

update_or_create() 를 사용해서 편리하게 데이터가 있으면 업데이트, 없으면 생성하고있었는데...


 raise self.model.MultipleObjectsReturned(

ehr.models.AnnualLeaveDetail.MultipleObjectsReturned: get() returned more than one AnnualLeaveDetail -- it returned 2!


확인해보니,

get_or_create() 가 DB레벨의 Unique는 보장하지 않는다.


As described above in get_or_create(), this method is prone to a race-condition which can result in multiple rows being inserted simultaneously if uniqueness is not enforced at the database level.

참조:

https://docs.djangoproject.com/en/4.0/ref/models/querysets/#update-or-create



But, In my case,

구 버전의 일부 IE에서 중복으로 AJAX 를 던지는 문제로 '추측'하고있다.